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)

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