public ActionResult loginAccess(ecom_tbl_User _log) { string OldHASHValue = string.Empty; IGenericService <ecom_tbl_User> _igenericService = new GenericService <ecom_tbl_User>(); ecom_tbl_User _logInfo = new ecom_tbl_User(); if (ModelState.IsValid) { if (_log != null && _log.Password != null && _log.Email != null) { _logInfo = _igenericService.GetFirstOrDefault(filter: q => q.Email == _log.Email && q.Password == _log.Password); if (_logInfo != null) { OldHASHValue = _logInfo.PasswordHashKey == null ? new Cipher().Encrypt(_log.Email + _log.Password) : _logInfo.PasswordHashKey; if (OldHASHValue != null) { bool isLogin = CompareHashValue(_log.Email.ToString(), _log.Password, OldHASHValue); if (isLogin) { //Login Success //For Set Authentication in Cookie (Remeber ME Option) SignInRemember(_logInfo.Email.ToString(), false); Session["User_Email"] = _logInfo.Email; Session["User_Name"] = _logInfo.UserName; Session["UserID"] = _logInfo.UserId; //Set A Unique ID in session if (_logInfo.UserRole == "Admin") { return(Json(new { redirectionURL = "/Admin/Dashboard/Index", loginfo = _logInfo }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { redirectionURL = "/Customer/Admin_Category", loginfo = _logInfo }, JsonRequestBehavior.AllowGet)); } } } } } } return(Json(new { res = false }, JsonRequestBehavior.AllowGet)); }