c# - ASP.NET MVC change default route on login/logout -
i have pretty simple requirement.
if user goes http://www.somedomain.com/ , not logged, want mvc route user homecontroller.
if user goes http://www.somedomain.com/ , logged in, want mvc route user clientcontroller.
is there easy solution problem?
thank much!
in homecontroller, index action, redirect clientcontroller if httpcontext.user not null:
public class homecontroller : controller { public actionresult index() { if (httpcontext.user != null) { redirecttoaction("index", "client"); } } }
edit: or use request.isauthenticated
public class homecontroller : controller { public actionresult index() { if (request.isauthenticated) { redirecttoaction("index", "client"); } } }
Comments
Post a Comment