1

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 Answer 1

1

In your HomeController

public ActionResult Index()
{
    if (User.Identity.IsAuthenticated) return view("Logged");
    else return View("NotLogged");
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.