public ActionResult DoLogin(FSCLogin objLogin) { string msgType = "Error"; string msg = string.Empty; try { if (ModelState.IsValid) { ClsLogin objClsLogin = new ClsLogin(); FSCLogin objLoginDetail = objClsLogin.AuthenticateUser(objLogin.Email); if (objLoginDetail != null && objLoginDetail.UserId > 0) { if (objLoginDetail.Password == FSCSecurity.EncryptPassword(objLogin.Password)) { //Initialise Session if (FSCWebRespository.InitialiseSession(objLoginDetail.UserId)) { FormsAuthentication.SetAuthCookie(objLogin.Email.ToUpper(), true); return(RedirectToAction("../Home/Home")); } else { msg = "Technical Error!"; } } else { msg = "Invalid Password!"; } } else { msg = "Invalid User"; } ViewBag.MsgType = msgType; ViewBag.Msg = msg; } return(View("Login")); } catch (Exception ex) { throw ex; } }