4
Reply

Can I send HTML string to Controller? if Yes then How.?

Pavan Satpute

Pavan Satpute

9y
3.7k
0
Reply

    May be it'll be helpful for you - Index.csHtml ------------------------ @{ ViewBag.Title = "title"; Layout = "~/Views/Shared/_Layout.cshtml"; }

    title

    Controller.CS ------------------------ using System.Web.Mvc; namespace MvcPlayground.Controllers { public class StackController : Controller { // // GET: /Stack/ public ActionResult Index() { return View(); } public ActionResult Create(FormCollection form) { string htmlStr = form["content"].ToString(); return View("Index"); } } }

    Yes you can, there is two ways 1. Using web.config ---> appsettings 2. Put one attribute ([ValidateInput(false)]) onto the action that you want to posting back on the server side

    http://stackoverflow.com/questions/16682450/passing-string-with-html-tags-to-controller-in-asp-net-mvc

    Yes we can send HTML string to Controller. we need to put [ValidateInput(false)] on the action method on controller side.