Interviews4 answers
What is the use of NonActionAttribute in Asp.Net MVC?
Ankit Kumar
Posted Sep 11, 2012, 7:43 PM EDT4 Answers
[NonAction]
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
Arulselvan PPosted Feb 2, 2016, 5:12 AM EST
If you decorated action method with [NonAction] attribute you can't access that through URL.We can restrict this by using private also,but in some scenarios we need public access so by decarating with [NonAction] attribute we can prevent.
Anil KesanaPosted Jun 15, 2015, 3:04 AM EDT
This is indicate that a controller method is not an action method.
Example:
[NonAction]
public void IndexTest()
{
// Do some thing
}
this is very useful attribute when visibility of controller 's method cannot be changed to private.
Jignesh TrivediPosted Apr 23, 2014, 11:20 PM EDT
This is the action filter attribute, used to indicate this method of controller is not an action method.
Jignesh TrivediPosted Apr 14, 2014, 12:22 AM EDT

