SharePoint 2010 – Page layout not valid on postback

1 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 1 LinkedIn 0 1 Flares ×

I came across a strange problem today when implementing a custom webpart. I was testing the webpart and when clicking a button on it (thus causing a postback) I was getting the error below:

“This page is not using a valid page layout. To correct the problem, edit page settings and select a valid page layout.”

The common cause of this error is after migrating pages – it is usually due to the page layout url being hard coded to the website in which it was created. This is a bug and a pain – but it wasn’t the problem this time. Firstly, my page was loading fine – it was only throwing an error on postback. Secondly, I already checked the page definition and the reference was fine.

After doing much testing I finally narrowed it down to the fact that I had a querystring parameter with the name “id” – on changing the name of this parameter I found that the problem disappeared. Apparently there are few reserved query string parameters you shouldn’t use in your SharePoint web applications:

http://blogs.technet.com/b/stefan_gossner/archive/2009/01/30/querystring-parameters-you-should-not-use-in-your-sharepoint-application.aspx

It does make sense that SharePoint has reserved parameters like these – but the error message was totally misleading!!

Matt

The Essential App Marketing Kit
Subscribe To My Newsletter To Get an Entire Chapter From The Book for FREE
Never display this again
1 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 1 LinkedIn 0 1 Flares ×