tags:

views:

21

answers:

1

hi all,

in asp.net MVC architecture, can i write AuthorizeAttribute on the method of model class?

i am trying to do this but its not working.

please let me know how can i do this..?

+1  A: 

No, you can apply authorization to controller's actions only.

You should check there if the user can access the actions performed on the model and then do it. Putting authorization on the model is not good, because the same model may be used in different actions, and the user may be authorized to some, and denied some other.

Palantir
thanks Palantir.
Rahul Somwanshi
If this answer was helpful, you should accept it (click on the V sign here on the left) or at least upvote it (press the up arrow). It's the way to say "thank you" and to tell everyone that your question has been answered.
Palantir