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

适用于

另请参阅