Export (0) Print
Expand All

HttpWebRequest.Address Property

Gets the URI of the Internet resource that actually responds to the request.

[Visual Basic]
Public ReadOnly Property Address As Uri
[C#]
public Uri Address {get;}
[C++]
public: __property Uri* get_Address();
[JScript]
public function get Address() : Uri;

Property Value

A Uri identifying the Internet resource that actually responds to the request. The default is the URI used by the WebRequest.Create method to initialize the request.

Remarks

The Address property is set to the URI that actually responds to a request, after any redirections that might happen during the request are complete.

The URI of the original request is kept in the RequestUri property.

Example

The following example checks to see if the HttpWebRequest instance req was redirected to another location to fulfill the request, and sets the value of the hasChanged variable to true if the request was redirected; otherwise hasChanged is set to false.

[Visual Basic] 
Dim hasChanged As Boolean = _
   (req.RequestUri.ToString() <> req.Address.ToString())


[C#] 
bool hasChanged = (req.RequestUri != req.Address);
 

[C++] 
bool hasChanged = req->RequestUri->Equals(req->Address);
 

[JScript] 
var hasChanged : Boolean = (req.RequestUri.ToString() != req.Address.ToString())

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

HttpWebRequest Class | HttpWebRequest Members | System.Net Namespace

Show:
© 2014 Microsoft