HttpRequest.PathInfo 屬性

定義

取得具有 URL 副檔名之資源的其他路徑資訊。Gets the additional path information for a resource with a URL extension.

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

屬性值

String

資源的其他路徑資訊。The additional path information for a resource.

範例

下列程式碼範例會判斷 PathInfo 屬性是否包含空字串。The following code example determines whether the PathInfo property contains an empty string. 如果有的話,方法會將 Write 表示此的字串寫入檔案。If it does, the Write method writes a string indicating this to a file. 如果不是,則 HtmlEncode 方法會以 HTML 編碼 PathInfo 屬性值,而方法會將 WriteLine 編碼值寫入檔案。If it does not, the HtmlEncode method HTML-encodes the value of the PathInfo property and the WriteLine method writes the encoded value to the file. 這個程式碼範例是針對類別提供之較大範例的一部分 HttpRequestThis code example is part of a larger example provided for the HttpRequest class.

// 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。For the URL http://www.contoso.com/virdir/page.html/tail, the PathInfo value is /tail.

適用於

另請參閱