Share via


GetResponse Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Returns a response from an Internet resource.

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

Syntax

'Declaration
Public Overrides Function GetResponse As WebResponse
public override WebResponse GetResponse()
public:
virtual WebResponse^ GetResponse() override
abstract GetResponse : unit -> WebResponse 
override GetResponse : unit -> WebResponse 
public override function GetResponse() : WebResponse

Return Value

Type: System.Net. . :: . .WebResponse
A WebResponse that contains the response from the Internet resource.

Remarks

The GetResponse method returns a WebResponse object that contains the response from the Internet resource. The actual instance returned is an HttpWebResponse, and can be typecast to that class to access HTTP-specific properties.

Warning

You must call the Close method to close the stream and release the connection. Failure to do so may cause your application to run out of connections.

When using the POST method, you must get the request stream, write the data to be posted, and close the stream. This method blocks waiting for content to post; if there is no time-out set and you do not provide content, the calling thread blocks indefinitely.

.NET Framework Security

See Also

Reference

HttpWebRequest Class

System.Net Namespace