ערוך

שתף באמצעות


HttpWebRequest.Address Property

Definition

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

Uri

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.

Applies to