SPUtility.OriginalServerRelativeRequestUrl property

Gets the original URL after the Microsoft SharePoint Foundation server has re-written it.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Shared ReadOnly Property OriginalServerRelativeRequestUrl As String
    Get
'Usage
Dim value As String

value = SPUtility.OriginalServerRelativeRequestUrl
public static string OriginalServerRelativeRequestUrl { get; }

Property value

Type: System.String
A String object that contains the original server-relative request URL received by SharePoint Foundation, or returns a null reference (Nothing in Visual Basic) if this property is used outside of the context of a Web request.

Remarks

In the context of a Web request, SharePoint Foundation can rewrite URLs in _layouts and a few other file system directories. This property returns the original URL before it was rewritten, which is useful if you need to get the subweb from which an application page was loaded. For example, when you open the link /subweb/_layouts/settings.aspx, SharePoint Foundation will rewrite the request URL to /_layouts/settings.aspx.

See also

Reference

SPUtility class

SPUtility members

Microsoft.SharePoint.Utilities namespace