共用方式為


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"

適用於