by Johnny Nouel
26. marzo 2011 21:57
About a year ago I read the following blog post by Scott Hanselman. It warns you on stuff you should take into consideration when moving your application to the ASP.NET 4 application pool.
Even though I read that article about a year ago I forgot all about it when I decided to switch the application pool to ASP.NET 4 for this little blog here you're reading. I was running BlogEngine 1.5.0.7 under ASP.NET 3.5 and made the switch.
BAM!

Whenever I tried to post some data into my blog using the built-in editor the error above appeared. Of course that was not the page I got when the error happened as I had CustomErrors turned on. I replicated the issue on my machine and saw the Yellow Screen of Death. Thankfully the error description was self explanatory and even pointed the solution to the reader.
Now I remembered Scott Hanselman's post. Since ASP.NET 4 has a more strict validation as opposed to ASP.NET 2.0-3.5 you may have to revert to the old settings if you wish to have the old behavior activated. Just add the following in the httpRuntime element of the web.config file.
<httpRuntime requestValidationMode="2.0"/>
ASP.NET 4 is trying to protect you against Script Attacks. You can also check and sanitize your web application's input and avoid the error.
What to read:
Soon I'll be upgrading the Blog to BlogEngine 2.0 running under ASP.NET 4.
Happy Programming. 