views:

60

answers:

1

Hi,

Currently I am using ASP.NET MVC and have home/index for logged out user which appears as "/" but this has got me confused as to how I can have "/" for a logged in user?

I could modify like 127.0.0.1/home - but I want it like "/". My confusion relates to the fact that the "/" [127.0.0.1/] is bound in the routes collection to home/index.

How can I have it so that "/" is shared for login/logout ?

+1  A: 

In your HomeController

public ActionResult Index()
{
    if (User.Identity.IsAuthenticated) return view("Logged");
    else return View("NotLogged");
}
Francisco