Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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/
                        }
                    }
                }
            });
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 at 10:46
    
Can you share the code pls –  Arsalan Adam Khatri May 7 at 10:47

1 Answer 1

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.

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

share|improve this answer

Your Answer

 
discard

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.