Tuesday, March 16, 2010

SharePoint unexpected error problem

One of the weired problem with sharepoint is the error below. Sharepoint does not let you change an existing list to add columns to it or edit your wikipages. The error given is "An unexpected error has occurred"
Trying to solve this problem you would normally think that you want more details about the error. in order to get more details you would need to change this custom error page and see the full call stack. in order to do this you would change web.config CustomErrors settings and the call stack settings. the web.config is the web.config of your default website. so go ahead and change these two settings as follows.
CallStack="true"
customErrors mode="Off"
After you change these two settings and try to add a column to your list in sharepoint or modify an existing wikipage sharepoint will tell you more details about the error and you know what the error was? it was in validateRequest=true setting. Sharepoint does not like this setting to be true. so go ahead and change it to false as follows
validateRequest="false"
this will basically tell sharepoint to not validate the request for inclusion of javascript which will make your sharepoint subject to XSS attacks but it will solve your problem of not being able to modify existing sharepoint webparts like wikipedia and list columns. Weired but this is how to solve it.

Thursday, March 04, 2010

Cross Domain Solution is JSONP

If you encounter the cross domain problem then you should use JSONP. It seems JSONP is going to be adopted in .Net 4 (reference: http://bendewey.wordpress.com/2009/11/24/using-jsonp-with-wcf-and-jquery/)

to use JSONP download the classes
JSONPBehavior
JSONPBindingExtension
JSONPEncoderFactory
JSONPBindingElement

from

and implement the solution as explained in

you can download the code demonstrating the entire solution from aliayman.com/download/crossdomainJSONP.zip