HttpRequest.Url 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得目前請求網址的資訊。
public:
property Uri ^ Url { Uri ^ get(); };
public Uri Url { get; }
member this.Url : Uri
Public ReadOnly Property Url As 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>")