0

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";
                        operation.Begin();
                        MeetingManager.CreateMeetingAndFillUrl(elevatedSite, currentMeeting);

                        try
                        {
                            operation.End(currentMeeting.Url);
                        }
                        catch (ThreadAbortException)
                        {
                            // This exception is thrown because the SPLongOperation.End
                            // calls a Response.End internally
                            // see: http://dotnetfollower.com/wordpress/2011/08/sharepoint-how-to-use-splongoperation/
                        }
                    }
                }
            });
2
  • 1) Don't have a web for site creation 2) I thought it's better to use validateformdigest Commented May 7, 2014 at 10:46
  • Can you share the code pls Commented May 7, 2014 at 10:47

1 Answer 1

0

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.

http://nikpatel.net/2013/09/06/sharepoint-march-2013-public-update-invalid-formdigest-client-svc-processquery-403-forbidden/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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