I am using mvc application. I want to add a login page for my mvc application. I created a login.cshtml file for login form (it contains user name and password). When I run the project, it starts with the home page. I want to start with login page. How can I achieve this?
Go to App_Start
folder in your solution and open RouteConfig.cs
and replace this method with your code:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
);
}
Hope it help you!
@NivithaG try this solution
Thanks. It is useful for me.