HttpRequest.RawUrl 属性

定义

获取当前请求的原始 URL。Gets the raw URL of the current request.

public:
 property System::String ^ RawUrl { System::String ^ get(); };
public string RawUrl { get; }
member this.RawUrl : string
Public ReadOnly Property RawUrl As String

属性值

当前请求的原始 URL。The raw URL of the current request.

示例

下面的代码示例使用HtmlEncode方法对RawUrl属性的值进行 HTML 编码,并WriteLine使用方法将编码的值写入文件。The following code example uses the HtmlEncode method to HTML-encode the value of the RawUrl property and the WriteLine method to write the encoded value to the file. 此代码示例是为HttpRequest类提供的更大示例的一部分。This code example is part of a larger example provided for the HttpRequest class.

// Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.PhysicalApplicationPath));
sw.WriteLine(Server.HtmlEncode(Request.PhysicalPath));
sw.WriteLine(Server.HtmlEncode(Request.RawUrl));
' Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.PhysicalApplicationPath))
sw.WriteLine(Server.HtmlEncode(Request.PhysicalPath))
sw.WriteLine(Server.HtmlEncode(Request.RawUrl))

注解

原始 URL 定义为后面包含域信息的 URL 部分。The raw URL is defined as the part of the URL following the domain information. 在 url 字符串http://www.contoso.com/articles/recent.aspx中,原始 URL 为/articles/recent.aspx。In the URL string http://www.contoso.com/articles/recent.aspx, the raw URL is /articles/recent.aspx. 原始 URL 包括查询字符串(如果存在)。The raw URL includes the query string, if present.

适用于