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.
答案 0 :(得分:1)
我并不完全了解您要对布局文件执行的操作,但您可以使用[ChildActionOnly]
修饰Action方法,以防止用户直接导航到它们。请参阅:Using ChildActionOnly in MVC