8
Reply

What is NonActionAttribute ?

    If you want to restrict a particular method from accessing Get and Post Method then you represent [Nonaction] attribute

    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.

    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.

    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 attributeBy using this we changing the default behaviour

    -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() { }

    https://msdn.microsoft.com/en-us/library/system.web.mvc.nonactionattribute%28v=vs.118%29.aspx

    Which does not come under the category of HTTPGET & HTTPPOST attributes. Its just like a normal method.

    This is the action filter attribute, used to indicate this method of controller is not an action method.