HttpWebRequest.Address Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the Uniform Resource Identifier (URI) of the Internet resource that actually responds to the request.
public:
property Uri ^ Address { Uri ^ get(); };
public Uri Address { get; }
member this.Address : Uri
Public ReadOnly Property Address As Uri
Property Value
A Uri that identifies the Internet resource that actually responds to the request. The default is the URI used by the Create(String) method to initialize the request.
Examples
The following code example checks to see if the HttpWebRequest object 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
.
bool hasChanged = req->RequestUri->Equals( req->Address );
bool hasChanged = (req.RequestUri != req.Address);
Dim hasChanged As Boolean = _
(req.RequestUri.ToString() <> req.Address.ToString())
Remarks
Caution
WebRequest
, HttpWebRequest
, ServicePoint
, and WebClient
are obsolete, and you shouldn't use them for new development. Use HttpClient instead.
The Address property is set to the URI after any redirections that happen during the request are complete.
The URI of the original request is kept in the RequestUri property.