共用方式為


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)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)> _
Public Shared ReadOnly Property OriginalServerRelativeRequestUrl As String
    Get
'Usage
Dim value As String

value = SPUtility.OriginalServerRelativeRequestUrl
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)]
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