語言

HttpRequest.Url 屬性

定義

取得目前請求網址的資訊。

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

屬性值

Uri

一個 Uri 包含當前請求 URL 的物件。

範例

以下程式碼範例將 Uri 當前請求的物件指派給物件變數,並將 URL 物件兩個屬性的值顯示給 HTTP 輸出。

Uri MyUrl = Request.Url;
 Response.Write("URL Port: " + MyUrl.Port + "<br>");
 Response.Write("URL Protocol: " + Server.HtmlEncode(MyUrl.Scheme) + "<br>");

Dim MyUrl As Uri = Request.Url
 Response.Write("URL Port: " & MyUrl.Port & "<br>")
 Response.Write("URL Protocol: " & Server.HtmlEncode(MyUrl.Scheme) & "<br>")

適用於

另請參閱