HttpRequest.CurrentExecutionFilePath HttpRequest.CurrentExecutionFilePath HttpRequest.CurrentExecutionFilePath HttpRequest.CurrentExecutionFilePath Property

定義

取得目前要求的虛擬路徑。Gets the virtual path of the current request.

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

屬性值

目前要求的虛擬路徑。The virtual path of the current request.

範例

下列程式碼範例會使用HtmlEncode方法,以 HTML 編碼的值CurrentExecutionFilePath屬性和WriteLine方法來寫入檔案的編碼的值。The following code example uses the HtmlEncode method to HTML-encode the value of the CurrentExecutionFilePath 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(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 目前正在執行的頁面處理常式傳回的檔案路徑。CurrentExecutionFilePath returns the file path to the currently executing page handler. 使用重新導向案例ExecuteTransfer方法,這表示CurrentExecutionFilePath屬性傳回的路徑重新導向至 (子頁面) 頁面。For redirect scenarios using Execute and Transfer methods this means that the CurrentExecutionFilePath property returns the path to the page redirected to (child page). 不過,當用戶端重新導向至另一個頁面上,FilePath屬性傳回的原始頁面的路徑。However, when the client is redirected to another page, the FilePath property returns the path to the original page.

適用於

另請參閱