Friday 29 May 2009

Parser error : “The async attribute on the page directive is not allowed in this page”

Last week I bumped upon this error while I was trying to do an asynchrounous WCF service call from my "MS Project 2007 Web Access"-custom user control.

Turns out that you cannot set the Async="true" atttibute in the page directive af an aspx page in the Project Web Access.

The reason for this? Very simple ... the that SharePoint’s SPPageParserFilter class blocks some page directive attributes. When you use other attrubutes than the following list, you will get the error "The 'xxx' attribute on the page directive is not allowed in this page."

The list:

  • 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

To take care of this issue we chose to have a webservice call which will handle the Ascynhrounous WCF call, and from our web user control we called this webservice method sycnhrounous.... Maybe this is not the best solution, but we really had an issue, so a quick fix was necessary here...

To semi-colon or not to semi-colon

Do you need to end your T-SQL statements with a semi-colon (;)?
No, at least not yet. As stated in the following web page (http://msdn.microsoft.com/en-us/library/ms143729.aspx) "Not ending Transact-SQL statements with a semi-colon." will be replaced by "End Transact-SQL statements with a semi-colon ( ; )." in
future versions...

Is it a good practice to end your statements with a semi-colon?
Yes, because:
- it will be mandatory in the future.
- you need to use it with CTE.(where the preceeding statement needs to end with a ";")
- you need to end MERGE statements with a ";"

Tuesday 12 May 2009

Community Day 2009

Third Edition of Microsoft Community Day, a networking and knowledge sharing event.
Register yourself and be there!