SPUtility.OriginalServerRelativeRequestPath property

In the context of a web request, WSS will sometimes rewrite urls in _layouts and a few other file system directories. This property returns the original path before it was rewritten, which is useful if you need to get the subweb from which a layouts page was loaded. For example, when you open the link /subweb/_layouts/settings.aspx, WSS will rewrite the request url to /_layouts/settings.aspx, which is where the file is actually stored on the filesystem.

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

public static string OriginalServerRelativeRequestPath { get; }

Property value

Type: System.String
Returns String.