Does anybody know why SPSite.Exists(url)
return false although the url exists.
If I check the above statement, it returns false.
But I can open the site without any problems if I directly use
SPSite myRootSite = new SPSite(url);
Here is my coding .
if (SPSite.Exists(new Uri(url)))
{
SPSite myRootSite = new SPSite(url);
}
UPDATE :
Sorry , I was calling SharePoint from one of my business layer which is not allowed.
My Fault !!
The answer from Stefan is almost correct. Here is the complete code, which should determine correctly, if a SPWeb exists on the given URL: