Request Error - Posting HTML to a WCF via jQuery

I created a simple WCF service for handling jQuery calls (RESTful). The service was handling data from the website one of which was raw HTML. The HTML was sanitized on the server before being saved in a database. However, whenever I made a call to the server, it greeted me with the iconic error: Request Error.

I must say, this error wasn't easy to debug, primarily because the call wasn't even reach my code. It is only after some digging on the internet I managed to find a solution. As it turned out, IIS doesn't particularly like HTML content. It seems to think that everything is an XSS attack. I remember back 4 years having similar problem with sending WYSiWYG content to the server to be saved in a database. There is however a very simple solution. If you are using WCF service, escape the string:

Then in the WCF add the following:

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box