Share via


HostingEnvironment.ApplicationPhysicalPath 屬性

定義

取得應用程式之目錄在磁碟上的實體路徑。

public:
 static property System::String ^ ApplicationPhysicalPath { System::String ^ get(); };
public static string ApplicationPhysicalPath { get; }
static member ApplicationPhysicalPath : string
Public Shared ReadOnly Property ApplicationPhysicalPath As String

屬性值

應用程式之目錄在磁碟上的實體路徑。

範例

下列程式碼範例會 ApplicationPhysicalPath 使用 屬性來建構應用程式App_Data目錄中資料檔案的路徑。 如需執行範例所需的完整程式碼,請參閱類別概觀主題的 VirtualPathProvider 範例一節。

// Set the datafile path relative to the application's path.
dataFile = HostingEnvironment.ApplicationPhysicalPath + "App_Data\\XMLData.xml";
' Set the datafile path relative to the application's path.
dataFile = HostingEnvironment.ApplicationPhysicalPath & _
  "App_Data\XMLData.xml"

適用於