HttpRequest.PhysicalPath HttpRequest.PhysicalPath HttpRequest.PhysicalPath HttpRequest.PhysicalPath Property

定義

取得對應到要求的 URL 之實體檔案系統路徑。Gets the physical file system path corresponding to the requested URL.

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

屬性值

目前要求的檔案系統路徑。The file system path of the current request.

範例

下列程式碼範例會使用HtmlEncode方法,以 HTML 編碼PhysicalPath屬性的值和WriteLine方法,以將編碼的值寫入檔案。The following code example uses the HtmlEncode method to HTML-encode the value of the PhysicalPath property and the WriteLine method to write the encoded value to the file. 這個程式碼範例是針對HttpRequest類別提供之較大範例的一部分。This code example is part of a larger example provided for the HttpRequest class.

// 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中,屬性會傳回原始頁面的路徑。In redirect scenarios using Execute and Transfer, the PhysicalPath property returns the path to the original page. 若要尋找目前正在執行之頁面的實體路徑, MapPath請使用方法並將輸入引數CurrentExecutionFilePath設定為屬性。To find the physical path of the currently executing page use the MapPath method with the input argument set as the CurrentExecutionFilePath property.

適用於

另請參閱