SPSite.Exists method (Uri, Boolean)

SharePoint 2013

Determines if a site with the specified uri exists. Checks the config db cache and, additionally, checks the content database if checkContentDb is true.

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

public static bool Exists(
	Uri uri,
	bool checkContentDb


Type: System.Uri

The exact, absolute url of a site. i.e. http://server/sites/sitename, not http://server/sites/sitename/subweb/default.aspx

Type: System.Boolean

If true, does a deep check to see if the site collection is really existing in a content database. Otherwise, just looks up the site in config db cache, which may or may not be fresh.

Return value

Type: System.Boolean
true if the site exists; otherwise, false.