HttpWebRequest.Address 屬性


取得實際回應要求的網際網路資源統一資源識別元 (URI)。Gets the Uniform Resource Identifier (URI) of the Internet resource that actually responds to the request.

 property Uri ^ Address { Uri ^ get(); };
public Uri? Address { get; }
public Uri Address { get; }
member this.Address : Uri
Public ReadOnly Property Address As Uri



Uri,可識別實際回應要求的網際網路資源。A Uri that identifies the Internet resource that actually responds to the request. 預設值為 Create(String) 方法用來初始化要求的 URI。The default is the URI used by the Create(String) method to initialize the request.


下列程式碼範例會檢查是否已將 HttpWebRequest 物件重新 req 導向至另一個位置以滿足要求,並將變數的值設定 hasChanged 為( true 如果要求已重新導向),否則 hasChanged 會設定為 falseThe 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())


Address 要求期間發生的任何重新導向完成時,屬性會設定為 URI。The Address property is set to the URI after any redirections that happen during the request are complete.

原始要求的 URI 會保留在 RequestUri 屬性中。The URI of the original request is kept in the RequestUri property.