Access denied on second postback after creating page

Member since: 2008
 

I have a form that upon postback creates a new page. The first time after loading the page, this works fine. The second time I get the login screen. The log reveals an Access Denied line, but if i log in with whatever account or just enter the url of the page again it works. The access denied only appears after a second postback.

The form is loaded by a page (11931 in the log below), which has a contanier for the pages created (11932). The new page created under 11932 in the first postback is 12025 and in the second 12026. Each time a page is created, the "main" page 11931 is also updated. The error occurs because of this (if I don't update 11931 it does not occur, no matter how many times I post the form), but not when the page is updated (as seen in the log).

I suspect that the underscores after the page ID:s are related to the version of the page? However I can't work them out. Is is possible that my code somehow causes EPiServer to load the wrong version of 11931 (not the updated one) when the page posts back? When 11931 is loaded after saving it varies between sessions, which is also confusing.

 

//
// Initial request
//
2008-11-24 09:33:06,376 2.13.2 Loading page from database for page 1 2008-11-24 09:33:06,439 2.13.1 Loading children from database for parent 11931 2008-11-24 09:33:06,439 2.13.1 Loading children from database for parent 11932 2008-11-24 09:33:06,501 2.13.1 Loading children from database for parent 11928 2008-11-24 09:33:06,517 2.13.2 Loading page from database for page 210 2008-11-24 09:33:06,533 2.13.1 Loading children from database for parent 9989 2008-11-24 09:33:06,533 2.13.1 Loading children from database for parent 11799 2008-11-24 09:33:06,533 2.13.1 Loading children from database for parent 11917 2008-11-24 09:33:06,533 2.13.1 Loading children from database for parent 11801 2008-11-24 09:33:06,533 2.13.1 Loading children from database for parent 11802 2008-11-24 09:33:06,533 2.13.1 Loading children from database for parent 11865 2008-11-24 09:33:06,548 2.13.1 Loading children from database for parent 11921 2008-11-24 09:33:06,548 2.13.2 Loading page from database for page 216 2008-11-24 09:33:06,564 2.13.2 Loading page from database for page 197
//
// First postback, updating page 11931 and creating 12025
// 2008-11-24 09:33:19,783 1.2.3 Authenticate request 2008-11-24 09:33:19,783 6.4.3 Setting UI language to "SV" with locale 1053 2008-11-24 09:33:19,783 1.1.3 Page initialized 2008-11-24 09:33:19,814 2.13.1 Page save Publish SID='3 PageLink='11931' 2008-11-24 09:33:19,830 2.13.2 Loading page from database for page 11931 2008-11-24 09:33:19,830 2.13.1 Page save Publish SID='3 PageLink='12025' 2008-11-24 09:33:19,846 2.13.2 Loading page from database for page 12025_65102 2008-11-24 09:33:19,846 2.13.2 Loading page from database for page 12025 2008-11-24 09:33:19,846 2.13.2 Loading page from database for page 11931_65101 2008-11-24 09:33:19,861 2.13.1 Loading children from database for parent 11932
//
// Second postback, updating page 11931 and creating 12026
// 2008-11-24 09:33:24,127 1.2.3 Authenticate request 2008-11-24 09:33:24,127 6.4.3 Setting UI language to "SV" with locale 1053 2008-11-24 09:33:24,127 1.1.3 Page initialized 2008-11-24 09:33:24,143 2.13.1 Page save Publish SID='3 PageLink='11931' 2008-11-24 09:33:24,158 2.13.1 Page save Publish SID='3 PageLink='12026' 2008-11-24 09:33:24,158 2.13.2 Loading page from database for page 12026_65104 2008-11-24 09:33:24,158 2.13.2 Loading page from database for page 12026 2008-11-24 09:33:24,158 2.13.2 Loading page from database for page 11931 2008-11-24 09:33:24,158 2.13.2 Loading page from database for page 11931_65101 2008-11-24 09:33:24,174 1.1.1 Access denied

2008-11-24 09:33:24,174 1.2.3 Authenticate request

2008-11-24 09:33:24,174 6.4.3 Setting UI language to "SV" with locale 1053

2008-11-24 09:33:24,487 1.1.3 Page initialized

//

// Login screen appearing

//

// Load URL again, without logging in

//

2008-11-24 09:33:32,718 1.2.3 Authenticate request

2008-11-24 09:33:32,718 6.4.3 Setting UI language to "SV" with locale 1053

2008-11-24 09:33:32,718 1.1.3 Page initialized

2008-11-24 09:33:32,718 /* Removed URL */

2008-11-24 09:33:32,718 2.13.1 Loading children from database for parent 11932

#26157 Nov 24, 2008 9:47
  • Member since: 2008
     
    It seems like this was caused by the update to the page which was the CurrentPage when doing the postback. Probably some control on the page read it's CurrentPage PageData object before the update, and then tried to use it afterwards. I made a workaround by redirecting to the current page (refresh) after the page is updated.
    #26193 Nov 25, 2008 10:27