HttpRequest.PathInfo 屬性

定義

取得具有 URL 副檔名之資源的其他路徑資訊。

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

屬性值

String

資源的其他路徑資訊。

範例

下列程式碼範例會判斷 屬性是否 PathInfo 包含空字串。 如果這樣做, Write 方法會寫入字串,指出此字串至檔案。 如果沒有,則方法 HTML 會將 屬性的值 PathInfo 編碼, HtmlEncodeWriteLine 方法會將編碼的值寫入檔案。 此程式碼範例是針對 類別提供的較大範例的 HttpRequest 一部分。

// Write the PathInfo property value
// or a string if it is empty.
if (Request.PathInfo == String.Empty)
{
    sw.WriteLine("The PathInfo property contains no information.");
}
else
{
    sw.WriteLine(Server.HtmlEncode(Request.PathInfo));
}
' Write the PathInfo property value
' or a string if it is empty.
If Request.PathInfo = String.Empty Then
    sw.WriteLine("The PathInfo property contains no information.")
Else
    sw.WriteLine(Server.HtmlEncode(Request.PathInfo))
End If

備註

針對 URL http://www.contoso.com/virdir/page.html/tail ,此值 PathInfo 為 /tail。

適用於

另請參閱