Parser error : “The async attribute on the page directive is not allowed in this page”
I have seen this error on various forums for quite sometime and wondered what is that SharePoint is doing around this?
It usually happens when you add Asyc="True" attribute to a SharePoint page and try to run the page, you get Parser error "The async attribute on the page directive is not allowed in this page."
Upon further debugging and researching, found that SharePoint’s SPPageParserFilter class blocks some page directive attributes. Checked the details of the SPPageParserFilter and found that the following are the only Page attributes which allowed by SharePoint Page Parser. If you use any other attribute which is not in the list given below, SharePoint will throw exception that "The 'xxx' attribute on the page directive is not allowed in this page. "
- autoeventwireup
- buffer
- classname
- codebehind
- codepage
- compileroptions
- contenttype
- culture
- debug
- description
- enabletheming
- enableviewstate
- enableviewstatemac
- errorpage
- explicit
- inherits
- language
- lcid
- lineparagmas
- maintainscrollpositiononpostback
- masterpagefile
- responsencoding
- smartnavigation
- strict
- stylesheettheme
- targetschema
- theme
- title
- clienttarget
- uiculture
- warninglevel
Update: The highlighted 3 new entries were found in the Microsoft.SharePoint.dll for build number 12.0.6504.5000, bring the total count to 31.
As always… Happy Coding
Comments
Anonymous
May 20, 2009
PingBack from http://microsoft-sharepoint.simplynetdev.com/parser-error-%e2%80%9cthe-async-attribute-on-the-page-directive-is-not-allowed-in-this-page%e2%80%9d/Anonymous
June 01, 2009
I'm getting the same error. Any solution you get to resolve this error?Anonymous
June 02, 2009
Anuja, this list of allowed directives is hard coded inside SharePoint and these are the only allowed directives. If you use any other directive, which is not part of the list given, SharePoint will throw the error message.Anonymous
August 31, 2009
I'm getting this error on "maintainscrollpositiononpostback".