Friday, September 9, 2011

"A potentially dangerous Request.QueryString value was detected from the client" after upgrading to ASP.NET 4

The mentioned exception is happening because in ASP.NET 4, the request validation is now being called for every asp.net resource like web services and other httphandlers.As a result, you may get that exception even if you turned off the RequestValidation via: <pages validateRequest="false" .... section.
This is one of the breaking changes that were mentioned here.
 So the solution is to set the new HttpRuntime "RequestValidationMode" property to "2.0" and it should take care of that exception.

<httpRuntime requestValidationMode="2.0" />

Tuesday, August 9, 2011

Add code snippet to blogger - mystery solved

From the blog pandit blog's post
http://www.blogpandit.com/2009/05/add-code-snippet-to-blogger-mystery.html
There was a large discomfort among blogger fraternity for some time now, on how to give out code demonstration in blogger post.
Since whenever one simply tries to add a code to post, a blogspot engine executes the code and shows the code result creating problems.

Like for example if blog pandit have to demonstrate following hyperlink code through in blog pandit post



then blogger engine will replace the code with working link like following


A workaround for this that wont require any script installation whatsoever.
This is how you may achieve this.

Get your code ready that you want to post.
Next step is to parse the code; so go to Blogcrowds and get your code parsed.
Then copy the parsed code and put it within
tags to give it a elegant look, and paste at a place were you want it displayed, like this:


There you are ready to publish the code and observe the effects.