.NET Framework 类库
HttpRequest..::.PhysicalApplicationPath 属性

更新:2007 年 11 月

获取当前正在执行的服务器应用程序的根目录的物理文件系统路径。

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

语法

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

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

属性值

类型:System..::.String

当前应用程序的根目录的文件系统路径。

示例

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

Visual Basic
' 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))
C#
// 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
另请参见

参考

标记 :


Page view tracker