PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing a controller for an ASP.NET MVC application that manages message board postings.
The security protection built in to ASP.NET is preventing users from saving their HTML.
You need to enable users to edit and save their HTML while maintaining existing security protection measures.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
Example: ValidateInput at Action Method Level
The user can submit Html for this action method successfully with the following code.
public class HomeController : Controller
{
public ActionResult AddArticle()
{
return View();
}
[ValidateInput(false)]
[HttpPost]
public ActionResult AddArticle(BlogModel blog)
{
if (ModelState.IsValid)
{ }
return View();
}}
http://www.dotnettricks.com/learn/mvc/html-submission-by-validateinput-and-allowhtml-attribute-inmvc4


Leave a Reply