When Asp.net MVC 2.0 +. Net 4.0 is used... Detected a potentially dangerous request. form value "error Solution

Source: Internet
Author: User

When we use Asp.net to develop a web form page, we usually submit data containing HTML content to the background.ProgramCodeDuring processing, the validaterequest = "false" attribute is set for the page. After the attribute is set, the annoying "Slave client... A potentially dangerous request is detected. the error "form value" disappears.

 

This error has changed in ASP. net mvc 2;

 

First, if you are using. net 3.5, you only need to add a feature for the action that receives the form value: [validateinput (false)]. You do not need to set the validaterequest = "false" attribute on the page.

As follows:

[Httppost]
[Validateinput ( False )]
Public Actionresult articlesave (blogarticle Model)

 

 

However, if you are using. Net 4.0, you will find that this operation is still invalid.

 

Sorry, because. Net 4.0 has changed, you need to add it under the <system. Web> node in your web. config:

 

<HttpruntimeRequestvalidationmode= "2.0"/>

 

 

Now you can pass.

 

Hope you can communicate and make progress together! China Software ~

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.