Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
This sample shows how to turn off the HTTP Keep-alive behavior and get the protocol version number from the Web server.
Example
Dim HttpWReq As HttpWebRequest= _
CType(WebRequest.Create("https://www.contoso.com"), HttpWebRequest)
' Turn off connection keep-alives.
HttpWReq.KeepAlive = False
Dim HttpWResp As HttpWebResponse = _
CType(HttpWReq.GetResponse(), HttpWebResponse)
' Get the HTTP protocol version number returned by the server.
Dim ver As String = HttpWResp.ProtocolVersion.ToString()
HttpWResp.Close()
HttpWebRequest HttpWReq =
(HttpWebRequest)WebRequest.Create("https://www.contoso.com");
// Turn off connection keep-alives.
HttpWReq.KeepAlive = false;
HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
// Get the HTTP protocol version number returned by the server.
String ver = HttpWResp.ProtocolVersion.ToString();
HttpWResp.Close();
Compiling the Code
This example requires:
- References to the System.Net namespace.