VS2010使用.net 4.0中的ASP.NET MVC 2 模板建立工程后无法提交HTML代码解决方案一则

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" />
posted @ 2009-10-30 17:09  重典  阅读(1684)  评论(2编辑  收藏  举报