See Also: WebResponse Members
The System.Net.WebResponse class is the abstract base class from which protocol-specific response classes are derived. Applications can participate in request and response transactions in a protocol-agnostic manner using instances of the System.Net.WebResponse class while protocol-specific classes derived from System.Net.WebResponse carry out the details of the request.
Client applications do not create System.Net.WebResponse objects directly; they are created by calling the WebRequest.GetResponse method on a System.Net.WebRequest instance.
The following example creates a System.Net.WebResponse instance from a System.Net.WebRequest .
C# Example
using System; using System.Net; public class WebResponseExample { public static void Main() { // Initialize the WebRequest. WebRequest myRequest = WebRequest.Create("http://www.contoso.com"); // Return the response. WebResponse myResponse = myRequest.GetResponse(); // Code to use the WebResponse goes here. // Close the response to free resources. myResponse.Close(); } }