HttpRequest.PhysicalPath 屬性

定義

取得對應到要求的 URL 之實體檔案系統路徑。

public:
 property System::String ^ PhysicalPath { System::String ^ get(); };
public string PhysicalPath { get; }
member this.PhysicalPath : string
Public ReadOnly Property PhysicalPath As String

屬性值

String

目前要求的檔案系統路徑。

範例

下列程式碼範例會 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))

備註

在使用 ExecuteTransfer 的重新導向案例中 PhysicalPath ,屬性會傳回原始頁面的路徑。 若要尋找目前執行頁面的實體路徑, MapPath 請使用 方法搭配設定為 屬性的 CurrentExecutionFilePath 輸入引數。

適用於

另請參閱