Share via


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. "

  1. autoeventwireup
  2. buffer
  3. classname
  4. codebehind
  5. codepage
  6. compileroptions
  7. contenttype
  8. culture
  9. debug
  10. description
  11. enabletheming
  12. enableviewstate
  13. enableviewstatemac
  14. errorpage
  15. explicit
  16. inherits
  17. language
  18. lcid
  19. lineparagmas
  20. maintainscrollpositiononpostback
  21. masterpagefile
  22. responsencoding
  23. smartnavigation
  24. strict
  25. stylesheettheme
  26. targetschema
  27. theme
  28. title
  29. clienttarget
  30. uiculture
  31. 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