共用方式為


HttpRequest.Path 屬性

定義

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

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

屬性值

目前請求的虛擬路徑。

範例

以下程式碼範例使用 HtmlEncode 了將屬性值 Path HTML 編碼的方法,以及 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))

備註

這是 PathFilePathPathInfo 拖車的連接。 例如,網址 http://www.contoso.com/virdir/page.html/tailPath /virdir/page.html/tail。

適用於

另請參閱