作者:www | 来源:互联网 | 2023-09-03 18:58
Iwantmyusertoberedirectedtotheloginformifheisnotloggedin?如果他没有登录,我希望我的用户被重定向到登录表单?
I want my user to be redirected to the login form if he is not logged in ?
如果他没有登录,我希望我的用户被重定向到登录表单?
The thing is that I don't wanna do this for every action. I know there is a way so that I may define this for every controller only once ( i.e. something executes regardless of the action in my controller ) but I can't remember how.
问题是我不想为每一个动作做这件事。我知道有一种方法可以让我只为每个控制器定义一次(即无论控制器中的动作如何都会执行),但我不记得是怎么回事。
3 个解决方案