更新:2007 年 11 月
命名空间:
System.Web 程序集:
System.Web(在 System.Web.dll 中)
Public ReadOnly Property CurrentExecutionFilePath As String
Dim instance As HttpRequest
Dim value As String
value = instance.CurrentExecutionFilePath
public string CurrentExecutionFilePath { get; }
public:
property String^ CurrentExecutionFilePath {
String^ get ();
}
/** @property */
public String get_CurrentExecutionFilePath()
public function get CurrentExecutionFilePath () : String
CurrentExecutionFilePath 返回当前正在执行的页处理程序的文件路径。对于使用 Execute 和 Transfer 方法的重定向方案,这意味着 CurrentExecutionFilePath 属性返回所重定向到的页(子页)的路径。但是,当客户端重定向到另一页时,FilePath 属性返回原始页的路径。
下面的代码示例使用 HtmlEncode 方法以 HTML 方式对 CurrentExecutionFilePath 属性和 WriteLine 方法的值进行编码,以便将已编码的值写入到文件中。此代码示例摘自一个为 HttpRequest 类提供的更大的示例。
' 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));
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
参考