HttpWebRequest.RequestUri 屬性
定義
取得要求的原始統一資源識別元 (URI)。Gets the original Uniform Resource Identifier (URI) of the request.
public:
virtual property Uri ^ RequestUri { Uri ^ get(); };
public override Uri RequestUri { get; }
public override Uri? RequestUri { get; }
member this.RequestUri : Uri
Public Overrides ReadOnly Property RequestUri As Uri
屬性值
Uri,包含傳遞到 Create(String) 方法的網際網路資源 URI。A Uri that contains the URI of the Internet resource passed to the Create(String) method.
範例
下列程式碼範例會檢查是否已將 HttpWebRequest 物件重新 req
導向至另一個位置以滿足要求,並將變數的值設定 hasChanged
為( true
如果要求已重新導向),否則 hasChanged
會設定為 false
。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())
備註
Uri呼叫所傳遞至的物件 HttpWebRequest WebRequest.Create 。The Uri object passed to HttpWebRequest by the call to WebRequest.Create.
在重新導向標頭之後,不會變更 RequestUri 屬性。Following a redirection header does not change the RequestUri property. 若要取得回應要求的實際 URI,請檢查 Address 屬性。To get the actual URI that responded to the request, examine the Address property.