Interviews8 answers
What is NonActionAttribute ?
8 Answers
NonAction is an attribute, it is used to represent that a controller method is not an action method.
Purpose: We known that all public methods of a controller class are basically treated as action methods. So restrict that we applying Nonaction attribute
By using this we changing the default behaviour
Ajay GandhiPosted Nov 20, 2015, 1:22 AM EST
If you want to restrict a particular method from accessing Get and Post Method then you represent [Nonaction] attribute
Shailesh UkePosted Jun 17, 2015, 5:51 AM EDT
-Usually, MVC consider all public methods of a controller class as action methods.
-You can make some of the methods as non action methods by using the NonActionAttribute attribute.
example:
[NonAction]
private void DoSomething()
{
}
Jaipal ReddyPosted Jun 17, 2015, 4:13 AM EDT
If you want to restrict a particular method from accessing using a url like other action methods and you want to declare that method as public inorder to access it from some other controller then decorate that method with [Nonaction] attribute.
lokaprakashraju pPosted Jun 16, 2015, 8:59 AM EDT
https://msdn.microsoft.com/en-us/library/system.web.mvc.nonactionattribute%28v=vs.118%29.aspx
Khan Abrar AhmedPosted Jun 16, 2015, 2:53 AM EDT
Which does not come under the category of HTTPGET & HTTPPOST attributes.
Its just like a normal method.
Sreekanth ReddyPosted Jun 16, 2015, 2:36 AM EDT
This is the action filter attribute, used to indicate this method of controller is not an action method.
Munesh SharmaPosted Jun 15, 2015, 8:28 PM EDT
Represents an attribute that is used to indicate that a controller method is not an action method.
It is already known that all the public methods of a controller class are basically treated as action methods.
If you don't want this default behaviour, then you can change the public method with NonActionAttribute. Then, the default behaviour changes.
Alankar BhoaslePosted Jun 9, 2015, 9:51 PM EDT





