PrepAway - Latest Free Exam Questions & Answers

You are developing a controller for an ASP.NET MVC application that manages message blog postings.

You are developing a controller for an ASP.NET MVC application that manages message blog 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?












A. OptionA

B. OptionB

C. OptionC

D. OptionD

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();

}

}

References: http://www.dotnettricks.com/learn/mvc/html-submission-by-validateinput-and-allowhtml-attribute-in-mvc4


Leave a Reply