Tuesday 26 October 2021

Save HTML Data from textBox in ASP.Net C# MVC

while  Submit HTML Content thorugh Form post method is now allowed because ASP.Net Stop IT to prevent RSS Attack So you will have to tell ASP.Net form to process HTML Data .. steps are given below .



[HttpPost, ValidateInput(false)]

        [ValidateAntiForgeryToken]

        public ActionResult TemplateAdd(DocumentTemplateModel data)

        {

            if (ModelState.IsValid)

            {

                string ErrMsg="";

                InsertRepository ob = new InsertRepository();

                if (ob.AddTemplate(data, ref ErrMsg))

                    return RedirectToAction("TemplateIndex", "act");

                else

                    return RedirectToAction("Error", "Common", new { msg = ErrMsg });

            }

            else

                return RedirectToAction("Error", "Common", new { msg = "Bot Attenot" });

        }






No comments:

Post a Comment