HttpRequest.RawUrl Property (System.Web)

Switch View :
ScriptFree
.NET Framework Class Library
HttpRequest.RawUrl Property

Gets the raw URL of the current request.

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

Visual Basic
Public Property RawUrl As String
C#
public string RawUrl { get; internal set; }
Visual C++
public:
property String^ RawUrl {
	String^ get ();
	internal: void set (String^ value);
}
F#
member RawUrl : string with get, internal set

Property Value

Type: System.String
The raw URL of the current request.
Remarks

The raw URL is defined as the part of the URL following the domain information. In the URL string http://www.contoso.com/articles/recent.aspx, the raw URL is /articles/recent.aspx. The raw URL includes the query string, if present.

Examples

The following code example uses the HtmlEncode method to HTML-encode the value of the RawUrl property and the WriteLine method to write the encoded value to the file. This code example is part of a larger example provided for the HttpRequest class.

Visual Basic

' Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.PhysicalApplicationPath))
sw.WriteLine(Server.HtmlEncode(Request.PhysicalPath))
sw.WriteLine(Server.HtmlEncode(Request.RawUrl))


C#

// Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(Request.PhysicalApplicationPath));
sw.WriteLine(Server.HtmlEncode(Request.PhysicalPath));
sw.WriteLine(Server.HtmlEncode(Request.RawUrl));


Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
See Also

Reference