public ActionResult Index(FormCollection frmCollection) { UserDataLayer userData = new UserDataLayer(); if (userData.UserAuthenticate(frmCollection["UserName"].ToString(), frmCollection["Password"].ToString())) { FormsAuthentication.RedirectFromLoginPage(frmCollection["UserName"].ToString(), false); FormsAuthentication.SetAuthCookie(frmCollection["UserName"].ToString(), false); string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; return(RedirectToAction("ShowRoute", "Home")); } else { ViewBag.Error = "Invalid user"; } return(View()); }