HttpRequest.Url 属性

定义

获取有关当前请求的 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

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

适用于

另请参阅