A potentially dangerous request.querystring value was detected from the client asp.net

Reading Time: 1 minute

Last Week, while working on an ASP.NET Web project, I got an issue. The issue was, when I am trying to pass unencoded HTML content into a querystring I got an error something like “A potentially dangerous Request. Form value was detected from the client”. After that I surf through the net and then got a solution. Here are possible solution which may help you. Put this below script in existing “page” directive in that .aspx file.

<%@ Page validateRequest="false" %> 

If you are having more pages in your project means its very difficult to put this code in each page.so add this below tag in Web.Config file to access it globally






If you are using .Net 4.0 than you have to make one more change in Web.Config file. Add this tag in section.

If You are facing the same problem in ASP.NET MVC 3.

Add this below code in Application_Start() method.

GlobalFilters.Filters.Add(new ValidateInputAttribute(false));

Note: When disabling the request validation on the application make sure to validate the entire application

 

Hope this helps.

Advertisement

More Articles for You

How to Get Lot of Exposure in Photography Field – Tips and Tricks

Seeing is more important than hearing. However, a good photography will explore the subject regarding place, person, location and thing. …

Expose Your Brand in Storytelling – Pros and Cons of Essential Elements

Storytelling is a technique in which we try to connect the customers through some sort of emotions. It is widely …

4 Investment Options that’ll Help You Reach Zero -Tax Income Level

The Budget for the fiscal year 2019-20 announced on 1st February 2019, declared a full tax rebate for incomes up …

How to Generate Income during Retirement

Retirement is truly the golden period of your life. This is the time when you are finally free from all …

Painting with sparklers fireworks – Behind the lens

Painting a picture with the sparklers is very interesting and fun work. At the same time, it teaches you a …

Beginners guide to design creative posters for freelance business

A poster is an informative creative design concept. It a combination of brilliant idea with a great aesthetic which could …