Compartilhar via


AlternateServerUrlFromHttpRequestUrl Method

The AlternateServerUrlFromHttpRequestUrl method of the SPUtility class returns the outgoing URL for the alternate request URL represented by the specified URI.

Parameters

url   A System.Uri object that represents the request URL.

Return Value

A System.Uri object that represents the outgoing URL and any additional parts of the URL, such as the path, that together compose the complete incoming URL. For example, if the incoming URL is http://incoming and the outgoing URL is http://outgoing, this method returns http://outgoing. If the incoming URL is http://incoming/sites/mySite/Lists/myList/AllItems.aspx, the returned URI object would represent http://outgoing/sites/mySite/Lists/myList/AllItems.aspx.

If no outgoing URL is defined for the zone associated with the incoming URL, or that incoming URL is not included within a collection of alternate URLs, Windows SharePoint Services returns the same System.Uri that was passed as parameter to this method.

Remarks

This method becomes available through installation of Service Pack 2 for Windows SharePoint Services 2.0.

Example

The following code example uses the AlternateServerUrlFromHttpRequestUrl method to list all the incoming URLs, their matching outgoing URLs, and the URL zone for each alternate request URL implemented on a virtual server.

This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint.Administration and Microsoft.SharePoint.Utilities namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security