Skip to content

Instantly share code, notes, and snippets.

@davehax
Created July 8, 2015 03:20
Show Gist options
  • Select an option

  • Save davehax/f01b477a79ec0e94652a to your computer and use it in GitHub Desktop.

Select an option

Save davehax/f01b477a79ec0e94652a to your computer and use it in GitHub Desktop.
'Inline' layouts page to check if a Site Collection exists
<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Assembly Name="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Assembly Name="Microsoft.SharePoint.IdentityModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.SharePoint.IdentityModel.Pages.IdentityModelSignInPageBase" %>
<script runat="server" type="text/C#">
protected void Page_Init(object sender, EventArgs e)
{
try
{
string site = Request.Params["Site"];
using (SPSite spsite = new SPSite(site))
{
Response.Write(true);
}
}
catch
{
Response.Write("false");
}
finally
{
Response.End();
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment