HttpRequest.Url HttpRequest.Url HttpRequest.Url HttpRequest.Url Property

定義

取得關於目前要求的 URL 資訊。Gets information about the URL of the current request.

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

屬性值

Uri 物件,其中包含目前要求的 URL。A Uri object that contains the URL of the current request.

範例

下列程式碼範例會指派Uri目前要求的物件變數,並顯示 URL 的兩個屬性的值物件至 HTTP 輸出的物件。The following code example assigns the Uri object of the current request to an object variable and displays the value of two properties of the URL object to the HTTP output.

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>")

適用於

另請參閱