Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to: Access HTTP-Specific Properties

This sample shows how to turn off the HTTP Keep-alive behavior and get the protocol version number from the Web server.

Dim HttpWReq As HttpWebRequest= _
    CType(WebRequest.Create("http://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()

This example requires:

  • References to the System.Net namespace.

© 2015 Microsoft