SPUtility.ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls method (String, Boolean)
Converts the specified relative URL with an embedded prefix to a server-relative URL and optionally encodes the site prefix.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Shared Function ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls ( _
value As String, _
ecmaScriptStringLiteralEncode As Boolean _
) As String
'Usage
Dim value As String
Dim ecmaScriptStringLiteralEncode As Boolean
Dim returnValue As String
returnValue = SPUtility.ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls(value, _
ecmaScriptStringLiteralEncode)
public static string ReplaceEmbeddedPrefixedUrlsWithServerRelativeUrls(
string value,
bool ecmaScriptStringLiteralEncode
)
Parameters
value
Type: System.StringThe server-relative URL.
ecmaScriptStringLiteralEncode
Type: System.Booleantrue to encode the site prefix; otherwise, false.
Return value
Type: System.String
Returns a String representation of the server-relative URL.
Remarks
This method converts a URL with the prefix "~site/" or "~sitecollection/" to a server-relative URL.