HostingEnvironment.ApplicationPhysicalPath 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得磁碟上的實體路徑,指向應用程式目錄。
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"