How to: Retrieve a Protocol-Specific WebResponse that Matches a WebRequest

This example shows how to retrieve a protocol-specific WebResponse that matches a WebRequest.

Example

WebRequest req = WebRequest.Create("http://www.contoso.com/");  
WebResponse resp = req.GetResponse();  
Dim req As WebRequest = WebRequest.Create("http://www.contoso.com")  
Dim resp As WebResponse = req.GetResponse()  

Compiling the Code

This example requires:

  • References to the System.Net namespace.

See Also

Requesting Data