GetResponseHeader Method

HttpWebResponse.GetResponseHeader Method (String)


Gets the contents of a header that was returned with the response.

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

member GetResponseHeader : 
        headerName:string -> string


Type: System.String

The header value to return.

Return Value

Type: System.String

The contents of the specified header.

Exception Condition

The current instance has been disposed.

Use GetResponseHeader to retrieve the contents of particular headers. You must specify which header you want to return.

Legacy Code Example

This example creates a Web request and queries for a response. If the site requires authentication, this example will respond with a challenge string. This string is extracted using GetResponseHeader.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft