更新:2007 年 11 月
命名空间:
System.Web 程序集:
System.Web(在 System.Web.dll 中)
Public ReadOnly Property PhysicalPath As String
Dim instance As HttpRequest
Dim value As String
value = instance.PhysicalPath
public string PhysicalPath { get; }
public:
property String^ PhysicalPath {
String^ get ();
}
/** @property */
public String get_PhysicalPath()
public function get PhysicalPath () : String
在使用 Execute 和 Transfer 的重定向方案中,PhysicalPath 属性返回原始页的路径。要查找当前执行页的物理路径,请使用 MapPath 方法,并将输入参数设置为 CurrentExecutionFilePath 属性。
下面的代码示例使用 HtmlEncode 方法以 HTML 方式对 PhysicalPath 属性和 WriteLine 方法的值进行编码,以便将已编码的值写入到文件中。此代码示例摘自一个为 HttpRequest 类提供的更大的示例。
' 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));
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
参考