Reputation: 181
How to prevent an action from execution if user types same action and controller in url in mvc4.Suppose I am having Action name as "Prevent" in controller name as "MyDept".Now I want to prevent this action from execution like if user types www.mysite.com/MyDept/Prevent then 404 error or page not found error should be diplayed.
Upvotes: 0
Views: 99
Reputation: 8415
if you have a method in your controller that you don't want it to be accessed decorate it with [NonAction]
attribute.
Upvotes: 2