开发者

asp.net mvc : can i write AuthorizeAttribute in model

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..?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜