What is the NonActionAttribute in mvc?
Loading
What is the NonActionAttribute in mvc?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Sep 24, 2022, 8:36 AM
Point 1. All public methods inside an MVC controller are Action methods. Meaning, they can directly be accessed through url ex:-(/Home/index) where Index is an action method.
point 2. There are situations where we create methods just for business requirement and should not be accessible from url .
in the below example we are displaying employees from Index() action method, which gets the list from employees() method, employees() method should not be an action method as we don't want user to access this method. so we can mark it as non Action attribute.
Rajanikant HawaldarPosted Sep 24, 2022, 9:01 AM
https://www.c-sharpcorner.com/interview-question/what-is-the-use-of-nonactionattribute-in-asp-net-mvc