Models/LoginModel.cs public class LoginModel { public string Username { get; set; } public string Password { get; set; } } Controllers/LoginController.cs using System.Collections.Generic; using System.Web.Mvc; using YourProjectName.Models; public class LoginController : Controller { // Simulated users private static List users = new List { new User { Username = "admin", Password = "admin123", Role = "Admin" }, new User { Username = "john", Password = "john123", Role = "Customer" } }; public ActionResult Index() { return View(); } [HttpPost] public ActionResult Index(LoginModel model) { var user = users.Find(u => u.Username == model.Username && u.Password == model.Password); if (user != null) { Session["User"] = user.Username; Session["Role"] = user.Role; return RedirectToAction("Dashboard"); } ViewBag.Message = "Invalid credentials"; return View(); } public ActionResult Dashboard() { if (Session["User"] == null) return RedirectToAction("Index"); ViewBag.Role = Session["Role"]; return View(); } public ActionResult Logout() { Session.Clear(); return RedirectToAction("Index"); } } Views/Login/Index.cshtml @model NetBankingLoginPortal.Models.LoginModel @{ ViewBag.Title = "Net Banking Login"; }

Net Banking Login

@using (Html.BeginForm()) {
@Html.LabelFor(m => m.Username) @Html.TextBoxFor(m => m.Username, new { @class = "form-control" })
@Html.LabelFor(m => m.Password) @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
}

@ViewBag.Message

Views/Login/Dashboard.cshtml @{ ViewBag.Title = "Dashboard"; }

Welcome, @Session["User"]!

Your role: @ViewBag.Role

@if (ViewBag.Role == "Admin") {

You have access to admin features.

} else if (ViewBag.Role == "Customer") {

You have access to customer features.

} Logout
In App_Start/RouteConfig.cs: routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Login", action = "Index", id = UrlParameter.Optional } ); Models/User.cs public class User { public string Username { get; set; } public string Password { get; set; } public string Role { get; set; } }