HttpRequest.CurrentExecutionFilePath 屬性

定義

取得目前要求的虛擬路徑。

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

屬性值

目前要求的虛擬路徑。

範例

下列程式碼範例會 HtmlEncode 使用 方法來 HTML 編碼 屬性的值 CurrentExecutionFilePath ,以及 WriteLine 將編碼值寫入檔案的方法。 此程式碼範例是針對 類別提供的較大範例的 HttpRequest 一部分。

// Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(DateTime.Now.ToString()));
sw.WriteLine(Server.HtmlEncode(Request.CurrentExecutionFilePath));
sw.WriteLine(Server.HtmlEncode(Request.ApplicationPath));
sw.WriteLine(Server.HtmlEncode(Request.FilePath));
sw.WriteLine(Server.HtmlEncode(Request.Path));
' Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(DateTime.Now.ToString()))
sw.WriteLine(Server.HtmlEncode(Request.CurrentExecutionFilePath))
sw.WriteLine(Server.HtmlEncode(Request.ApplicationPath))
sw.WriteLine(Server.HtmlEncode(Request.FilePath))
sw.WriteLine(Server.HtmlEncode(Request.Path))

備註

CurrentExecutionFilePath 會傳回目前執行之頁面處理常式的檔案路徑。 對於使用 ExecuteTransfer 方法的重新導向案例,這表示 CurrentExecutionFilePath 屬性會傳回重新導向至 (子頁面) 之頁面的路徑。 不過,當用戶端重新導向至另一個頁面時, FilePath 屬性會傳回原始頁面的路徑。

適用於

另請參閱