nikhil kandalkar
nikhil kandalkar

Reputation: 181

Prevent action from execution

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

Answers (1)

mohsen dorparasti
mohsen dorparasti

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

Related Questions