HttpRequest.PathInfo Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the additional path information for a resource with a URL extension.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

public string PathInfo { get; }

Property Value

Type: System.String

The additional path information for a resource.

For the URL Http://www.contoso.com/virdir/page.html/tail, the PathInfo value is /tail.

The following code example determines whether the PathInfo property contains an empty string. If it does, the Write method writes a string indicating this to a file. 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. This 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));
}

.NET Framework
Available since 1.1
Return to top
Show: