Reputation:
i want a facility that if user login then goes to home/index
i not want to use
return view('~/views/home/index');
i want to redirect it to a actionresult index of home controller of my web-application(in asp.net mvc)
how i can do this without return view(); i want to redirect him.
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()
}
Upvotes: 10
Views: 34700
Reputation: 1039438
You could redirect:
return RedirectToAction("index");
and if the action is on a different controller specify the controller name as well:
return RedirectToAction("index", "home");
Upvotes: 26