protected void btnCreateList_Click(object sender, EventArgs e)
{
SPWeb currentWeb = SPContext.Current.Web;
Guid webId = currentWeb.ID;
Guid siteId = currentWeb.Site.ID;
Response.Write(siteId);
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(siteId))
{
using (SPWeb web = site.OpenWeb(webId))
{
site.AllowUnsafeUpdates = true;
Response.Write("configured successfully");
}
}
});
}
protected void btnCreateList_Click(object sender, EventArgs e) { SPWeb currentWeb = SPContext.Current.Web; Guid webId =
Share
You are probably running the code outside the SharePoint, or before the SPContext is initialized (HTTP handler, for example).