请单击以进行评分并提供反馈
MSDN
MSDN Library
.NET 开发
.NET Framework
HttpRequest 类
 CurrentExecutionFilePath 属性

  开启低带宽视图
此页面仅适用于
Microsoft Visual Studio 2008/.NET Framework 3.5

同时提供下列产品的其他版本:
.NET Framework 类库
HttpRequest..::.CurrentExecutionFilePath 属性

更新:2007 年 11 月

获取当前请求的虚拟路径。

命名空间:  System.Web
程序集:  System.Web(在 System.Web.dll 中)

Visual Basic(声明)
Public ReadOnly Property CurrentExecutionFilePath As String
Visual Basic (用法)
Dim instance As HttpRequest
Dim value As String

value = instance.CurrentExecutionFilePath
C#
public string CurrentExecutionFilePath { get; }
Visual C++
public:
property String^ CurrentExecutionFilePath {
    String^ get ();
}
J#
/** @property */
public String get_CurrentExecutionFilePath()
JScript
public function get CurrentExecutionFilePath () : String

属性值

类型:System..::.String

当前请求的虚拟路径。

CurrentExecutionFilePath 返回当前正在执行的页处理程序的文件路径。对于使用 ExecuteTransfer 方法的重定向方案,这意味着 CurrentExecutionFilePath 属性返回所重定向到的页(子页)的路径。但是,当客户端重定向到另一页时,FilePath 属性返回原始页的路径。

下面的代码示例使用 HtmlEncode 方法以 HTML 方式对 CurrentExecutionFilePath 属性和 WriteLine 方法的值进行编码,以便将已编码的值写入到文件中。此代码示例摘自一个为 HttpRequest 类提供的更大的示例。

Visual Basic
' 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))

C#
// 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));

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

.NET Framework

受以下版本支持:3.5、3.0、2.0、1.1、1.0
社区内容   什么是社区内容?
添加新内容 RSS  批注
Processing
© 2009 Microsoft Corporation 版权所有。 保留所有权利  |  商标  |  隐私权声明
Page view tracker