When the client in MVC transmits a value to the server, if the client string contains "</>", it will report "potential danger "(
"A potentially dangerous request. form value was detected from the client".
For example, the request. form value is detected in the client ("test <br/> TTT.
Solution:
Add the [validateinput (false)] attribute to the corresponding action to solve the problem and remove verification.
However, it seems that the. NET 4.0 attribute does not work, so you can add it to the systerm. Web node in Web. config.
<Httpruntime requestvalidationmode = "2.0" type = "codeph" text = "/codeph"/>
Solution B:
Method A is a little troublesome, and there is a better solution in mvc3,CodeAs follows:
Namevaluecollection paramcoll = NULL; // comment strings are HTML strings, so get the unvalidate version here if (0 = string. compare (request. httpmethod, "Post", true) {paramcoll = new formcollection (request. unvalidated (). form);} else if (0 = string. compare (request. httpmethod, "get", true) {paramcoll = new namevaluecollection (request. unvalidated (). querystring);} else {paramcoll = request. params;
}