HttpRequest.CurrentExecutionFilePath HttpRequest.CurrentExecutionFilePath HttpRequest.CurrentExecutionFilePath HttpRequest.CurrentExecutionFilePath Property

定义

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

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

属性值

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

示例

下面的代码示例使用HtmlEncode方法对CurrentExecutionFilePath属性的值进行 HTML 编码,并WriteLine使用方法将编码的值写入文件。The following code example uses the HtmlEncode method to HTML-encode the value of the CurrentExecutionFilePath 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))

注解

CurrentExecutionFilePath返回当前正在执行的页处理程序的文件路径。CurrentExecutionFilePath returns the file path to the currently executing page handler. 对于使用ExecuteTransfer方法的重定向方案,这意味着属性返回重定向到的页的路径(子页面)。CurrentExecutionFilePathFor redirect scenarios using Execute and Transfer methods this means that the CurrentExecutionFilePath property returns the path to the page redirected to (child page). 但是,当客户端重定向到另一页时FilePath ,属性将返回原始页的路径。However, when the client is redirected to another page, the FilePath property returns the path to the original page.

适用于

另请参阅