"A potentially dangerous Request.Form value was detected from the client" fix for ASP.NET MVC

Here is a gotcha that I found while I had my "WebForms" hat on.

July 27th, 2009 at 8:00am — Comments: (1) — By: Jonathan Danylko — Tags: .NET

I've been working on a project and got the dreaded error:

"A potentially dangerous Request.Form value was detected from the client"

Well, after trying the "<@page validateRequest="false"...>", I realized that didn't work. So I started looking through the code and found the attribute:

[ValidateRequest(false)]

You need to attach the ValidateRequest(false) attribute to the method that is receiving the post.

Problem solved.

NOTE: However, make sure you are catching any type of malicious injections that could occur.

Picture of Jonathan Danylko
  • Jonathan Danylko Twitter Account LinkedIn Account Facebook Account

Jonathan Danylko is a freelance web architect and avid programmer who has been programming for over 20 years. He has developed various systems in numerous industries including e-commerce, biotechnology, real estate, health, insurance, and utility companies.

When asked what he likes doing in his spare time, he answers..."programming."

Related Posts

1 Comments

  1. Experts Comment
    November 27th, 2010 at 11:06pm
    You need to do couple of modification to you application to get this fixed.Have a look.

    http://www.a2zmenu.com/AspNet/A-potentially-dangerous-Request-Form-value-was-detected.aspx

Post a comment