Skip to content

09 Login Page as Startup Page

M. Fares edited this page Mar 12, 2018 · 1 revision

Q. How to make the login page the startup page of the project? Although, it is not a good design to start with a login page, there are many ways to achieve this task.

Option 1: Put [Authorize] before the HomeController (You may consider other controllers also)

[Authorize]
public class HomeController : Controller
{
...
}

Option 2: Change the default routing path in the /App_Start/RouteConfig.cs

routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }

Option 3: Right click on the the project name in the solution explorer, the click on properties. On the web tab, enter /Account/Login in the Specific Page field

Clone this wiki locally