Share via


SPAlternateUrlCollectionManager.SerializeUrlForStorage Method

Serializes the specified URL in a format appropriate for persistent storage.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Function SerializeUrlForStorage ( _
    url As String _
) As String
'Usage
Dim instance As SPAlternateUrlCollectionManager
Dim url As String
Dim returnValue As String

returnValue = instance.SerializeUrlForStorage(url)
public string SerializeUrlForStorage(
    string url
)

Parameters

  • url
    Type: System.String

    A string containing the URL to serialize.

Return Value

Type: System.String
A string that contains the serialized URL.

Examples

The following example verifies that the SerializeUrlForStorage method serializes a URL to match the default zone outgoing URL.

Dim altUrlCollection As SPAlternateUrlCollection = SPContext.Current.Site.WebApplication.AlternateUrls

Dim altUrlCollectionMgr As SPAlternateUrlCollectionManager = SPFarm.Local.AlternateUrlCollections

Dim responseUrl As String = altUrlCollectionMgr.SerializeUrlForStorage("http://MySerializedURL")

Dim altUrl As SPAlternateUrl = altUrlCollection.GetResponseUrl(SPUrlZone.Default)

If responseUrl.Equals(altUrl.IncomingUrl) Then
    Response.Write("Serialized URL matches outgoing URL.")
End If
SPAlternateUrlCollection altUrlCollection = SPContext.Current.Site.WebApplication.AlternateUrls;

SPAlternateUrlCollectionManager altUrlCollectionMgr = SPFarm.Local.AlternateUrlCollections;

string responseUrl = altUrlCollectionMgr.SerializeUrlForStorage("http://MySerializedURL");

SPAlternateUrl altUrl = altUrlCollection.GetResponseUrl(SPUrlZone.Default);

if (responseUrl.Equals(altUrl.IncomingUrl))
{
    Response.Write("Serialized URL matches outgoing URL.");
}

See Also

Reference

SPAlternateUrlCollectionManager Class

SPAlternateUrlCollectionManager Members

Microsoft.SharePoint.Administration Namespace