HttpRequest.Path 属性

定义

获取当前请求的虚拟路径。Gets the virtual path of the current request.

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

属性值

当前请求的虚拟路径。The virtual path of the current request.

示例

下面的代码示例使用HtmlEncode方法对Path属性的值进行 HTML 编码,并WriteLine使用方法将编码的值写入文件。The following code example uses the HtmlEncode method to HTML-encode the value of the Path 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(DateTime.Now.ToString()));
sw.WriteLine(Server.HtmlEncode(Request.CurrentExecutionFilePath));
sw.WriteLine(Server.HtmlEncode(Request.ApplicationPath));
sw.WriteLine(Server.HtmlEncode(Request.FilePath));
sw.WriteLine(Server.HtmlEncode(Request.Path));
' Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(DateTime.Now.ToString()))
sw.WriteLine(Server.HtmlEncode(Request.CurrentExecutionFilePath))
sw.WriteLine(Server.HtmlEncode(Request.ApplicationPath))
sw.WriteLine(Server.HtmlEncode(Request.FilePath))
sw.WriteLine(Server.HtmlEncode(Request.Path))

注解

Path FilePath是与PathInfo尾部的连接。The Path is the concatenation of the FilePath and the PathInfo trailer. 例如,对于 URL http://www.contoso.com/virdir/page.html/tail Path ,为/virdir/page.html/tail。For example, for the URL http://www.contoso.com/virdir/page.html/tail, the Path is /virdir/page.html/tail.

适用于

另请参阅