Is there an annotation/attribute which can be set on a controller method, to have that controller action require a specific key in my session to be set?
I’m looking for a way (other than forms authentication) to do some kind of smart authorization.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could extend
ActionFilterAttributein your own class and override theOnActionExecutingmethod. This method will get fired before entering the action:Then you can annotate any action:
Edit:
You can also get fancier and allow a property to be set in the attribute: