Where i need to authentication logic in my mvc project?

时间:2015-07-28 15:59:32

标签: jquery asp.net-mvc asp.net-mvc-4 model-view-controller

I have a MVC application where i have used jquery for service calls and displaying in the views. I am planning to add call to authentication in the layout page, but if user directly calls the partial view page, authentication will not call at all.

1 个答案:

答案 0 :(得分:1)

我并不完全了解您要对布局文件执行的操作,但您可以使用[ChildActionOnly]修饰Action方法,以防止用户直接导航到它们。请参阅:Using ChildActionOnly in MVC