Share via


SPSite.ValidateDomainCompatibility-Methode (SPSite, SPSite)

Überprüft, ob zwei URLs kompatibel-Domänen verfügen.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Shared Function ValidateDomainCompatibility ( _
    site1 As SPSite, _
    site2 As SPSite _
) As Boolean
'Usage
Dim site1 As SPSite
Dim site2 As SPSite
Dim returnValue As Boolean

returnValue = SPSite.ValidateDomainCompatibility(site1, _
    site2)
public static bool ValidateDomainCompatibility(
    SPSite site1,
    SPSite site2
)

Parameter

Rückgabewert

Typ: System.Boolean
Boolean
true wenn Domänen kompatibel sind; andernfalls false.

Hinweise

Verwenden Sie nur diese Überladung, wenn Sie wissen, dass diese Website-Lookup erfolgreich war und Sie zwei vorhandene Websitesammlungen haben. Wenn Sie nur Zeichenfolgen und weiß nicht, ob die Website Lookup erfolgreich war, rufen Sie die VisualUpgradeWebs() -Methode, die Überprüfung wird, auch wenn die URL nicht auf eine Websitesammlung verweist.

Mithilfe dieser Methode können Sie um domänenübergreifende Skriptangriffe zu blockieren. Beispielsweise http://Server1 und http://Server2 sind unterschiedliche Domänen, und Sie sollten möglicherweise nicht um eine Websitesammlung in einer Domäne aus der anderen Domäne zu aktualisieren. Folglich sollen durch ermöglicht dieser Methode stellen Sie sicher, dass beide Websitesammlungen innerhalb kompatibel Domänen vorhanden sind, wenn der Code Vorgänge mit anderen Websitesammlungen ausführt.

Domänen sind kompatibel, wenn sie auf den gleichen Inhalt zeigen. Beispielsweise sind https://domain1.com und http://domain2.com kompatibel, wie http://Intranet/ und http://extranet sind. Domänen wie http://www.hostheadersites.com und http://www.hostheadersites.com/sites/team sind auch kompatibel. Sind jedoch http://user1.hostheadersites.com und http://user2.hostheadersites.com nicht kompatibel.

This method also accounts for the relationship between site collections. If two site collections are members of the same site subscription, then their domains are compatible. A simple string comparison of URL host headers is not sufficient, because such a check would fail to properly account for alternate access mappings. Features which use both http://intranet and http://extranet would fail. Even without alternate access mapping, a string comparison is not sufficient because features fail to work correctly in reverse proxy configurations that remap host headers or ports (for example, when https://mydomain.com becomes http://1.2.3.4 at the load balancer.

Siehe auch

Referenz

SPSite Klasse

SPSite-Member

ValidateDomainCompatibility-Überladung

Microsoft.SharePoint-Namespace