Reputation: 16244
I want to retain the code of some unused methods in my controllers in case I need them again in future.
To prevent accidental access, I thought of using the following attribute to mark all such methods:
[Authorize(Roles="This Role will never be assigned.")]
This works, but only after first getting the user to log in. Is there a more elegant way?
Upvotes: 0
Views: 119
Reputation: 1258
Use The NonActionAttribute
. It allows you to mark public methods in a controller as not being available for external requests.
Upvotes: 1