Controller(HomeController):
public ActionResult Index() { ViewData["Message"] = "Welcome to ASP.NET MVC!"; return View(); } [ValidateInput(false)] public ActionResult Submit(string t1) { return Content(t1); }
View(Home/Index.aspx):
<form action="/home/submit" method="post"> <input name="t1" type="text"/> <input type="submit" value="submit" /> </form>
虽然设置了ValidateInput但是还是提交不了
在Web.Config中加设置以下代码即可
system.web中添加
<httpRuntime requestValidationMode="2.0" />
时间: 2024-10-27 23:17:26