我想要一个设施,如果用户登录然后转到家/索引
我不想用
return view('~/views/home/index');
Run Code Online (Sandbox Code Playgroud)
我想将它重定向到我的web应用程序的home controller的actionresult索引(在asp.net mvc中)
如何在没有返回视图的情况下做到这一点(); 我想重定向他.
public actionresult login
if(userlogin)
{
// goes to index page ? what i do here then user goes to index page of home controller
}
else
{
return view()
}
Run Code Online (Sandbox Code Playgroud)
Dar*_*rov 25
你可以重定向:
return RedirectToAction("index");
Run Code Online (Sandbox Code Playgroud)
如果操作在不同的控制器上,也指定控制器名称:
return RedirectToAction("index", "home");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29456 次 |
| 最近记录: |