SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a spweb in page_load via a control on the site. I get the error "The security validation for this page is invalid".

I've got a postback (No GET-Request) and also tried SPUtility.ValidateFormDigest in the onInit-Method and directly before RunWithElevatedPrivileagues.

I've placed a FormDigest Control on the ascx of my control. The masterpage is Seattle.master and contains the formdigestplceholder and control.

It works on the dev-system with farm-account but not on the integrationsystem. I'm on SP2013.

Any suggestions?

[Update 2] Ok the code in Update 1 wasn't the real problem. The real problem occured in the following line:

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CreateMeetingRepost", "document.forms[0].submit();", true);

In the Page_Load I'm registering this code to submit the site to itself for getting a postback. But after the postback occures and control is fully loaded the page is getting a security validation error somewhere else (not in my code). Any suggestions?

All I want to do is create a subsite. I tried AllowUnsafeUpdate on Rootweb and Site but that didn't work. SharePoint throws an innerexception while copying contenttype to the new web.

[Update1 - Not the Problem] Some Code - MeetingManager.CreateMeetingAndFillUrl creates the subsite

SPSecurity.RunWithElevatedPrivileges(() =>
                using (SPSite elevatedSite = new SPSite(SPContext.Current.Site.ID))
                    using (SPLongOperation operation = new SPLongOperation(this.Page))
                        operation.LeadingHTML = "Meeting wird erstellt";
                        MeetingManager.CreateMeetingAndFillUrl(elevatedSite, currentMeeting);

                        catch (ThreadAbortException)
                            // This exception is thrown because the SPLongOperation.End
                            // calls a Response.End internally
                            // see:
share|improve this question
1) Don't have a web for site creation 2) I thought it's better to use validateformdigest – Steffen Schindler May 7 '14 at 10:46
Can you share the code pls – Arsalan Adam Khatri May 7 '14 at 10:47
up vote 0 down vote accepted

I found the problem. All the code is correct but there is an error in March 2013 PU. The FormDigest is set invalid and when doing a post the error occures. This is a real bad error.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.