码迷,mamicode.com
首页 > Web开发 > 详细

.net mvc4 从客户端中检测到有潜在危险的 Request.Form 值

时间:2015-06-02 21:45:35      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

        [ValidateInput(false)] 即可, 网上说什么Web.Config 里面改,一点用都没有

 

        [HttpPost]
        [ActionName("Edit")]
        [ValidateInput(false)]  
        public ActionResult Edit(BlogInfo model)
        {
            model.UpdateTime = DateTime.Now;
            ef_Help.ModifyWithOutproNames<BlogInfo>(model, "CreateTime");
            // db.TagInfo.Where(X=>X.BlogID
            db.Database.ExecuteSqlCommand(string.Format(@"
            delete dbo.TagInfo where BlogID={0} delete dbo.Classification where BlogID ={1}", model.BlogID, model.BlogID));
            if (model.Tag != null)
            {
                foreach (var item in model.Tag.Split(,))
                {
                    db.TagInfo.Add(new TagInfo() { BlogID = model.BlogID, TagName = item });
                }
            }

            if (model.Classifications != null)
            {
                foreach (var item in model.Classifications.Split(,))
                {
                    db.Classification.Add(new Classification() { BlogID = model.BlogID, ClassificationName = item });
                }
            }

            db.SaveChanges();
            return View(model);
            //return Edit(model.BlogID);
            // Response.Write("1"); Response.End();

        }

 

.net mvc4 从客户端中检测到有潜在危险的 Request.Form 值

标签:

原文地址:http://www.cnblogs.com/bingguang/p/4547660.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!