public void LoginUser(ActionExecutingContext filterContext) { DeleteCaptcha(filterContext); LoginUserDetails objLoginUserDetails = null; objLoginUserDetails = (LoginUserDetails)Common.Common.GetSessionValue(ConstEnum.SessionValue.UserDetails); AuthenticationDTO objAuthenticationDTO = new AuthenticationDTO(); objAuthenticationDTO.LoginID = objLoginUserDetails.UserName; objAuthenticationDTO.Password = objLoginUserDetails.Password; UserInfoDTO objUserAfterValidationObject = null; UserInfoDTO objUserAunthentication = null; PasswordConfigDTO objPasswordConfig = null; List <string> lstAuthorizationActionLinks = null; List <int> lstAuthorisedActionId = null; List <ActivityResourceMappingDTO> lstActivityResourceMappingDTO = null; Dictionary <string, List <ActivityResourceMappingDTO> > dicActivityResourceMappingDTO = null; int loginCount = 0; bool lockFlag = false; bool flag = false; objAuthenticationDTO.Password = null; objLoginUserDetails.Password = null; objLoginUserDetails.IsAccountValidated = true; objLoginUserDetails.ErrorMessage = ""; UserInfoSL objUserInfoSL = new UserInfoSL(); //Load the action permissions in the session object for to be used when checking authorization objUserAunthentication = objUserInfoSL.GetUserAuthencticationDetails(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.UserName); filterContext.HttpContext.Session["GUIDSessionID"] = HttpContext.Current.Request.Cookies.Get("v_au").Value + objUserAunthentication.UserInfoId; objLoginUserDetails.LoggedInUserID = objUserAunthentication.UserInfoId; objLoginUserDetails.EmailID = objUserAunthentication.EmailId; objLoginUserDetails.FirstName = objUserAunthentication.FirstName; objLoginUserDetails.LastName = objUserAunthentication.LastName; objUserInfoSL.GetLoginUserApplicableActions(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID.ToString(), out lstAuthorizationActionLinks, out lstAuthorisedActionId); objLoginUserDetails.AuthorizedActions = lstAuthorizationActionLinks; lstAuthorisedActionId.Add(0); objLoginUserDetails.AuthorisedActionId = lstAuthorisedActionId; objLoginUserDetails.CompanyLogoURL = objUserAunthentication.CompanyLogoURL; objLoginUserDetails.UserTypeCodeId = Convert.ToInt32(objUserAunthentication.UserTypeCodeId); objLoginUserDetails.LastLoginTime = objUserAunthentication.LastLoginTime; objLoginUserDetails.DateOfBecomingInsider = objUserAunthentication.DateOfBecomingInsider; using (var objActivitySL = new ActivitySL()) { lstActivityResourceMappingDTO = objActivitySL.GetActivityResourceMappingDetails(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.LoggedInUserID); } dicActivityResourceMappingDTO = new Dictionary <string, List <ActivityResourceMappingDTO> >(); foreach (var objActivityResourceDTO in lstActivityResourceMappingDTO) { if (!dicActivityResourceMappingDTO.ContainsKey(objActivityResourceDTO.ColumnName)) { dicActivityResourceMappingDTO.Add(objActivityResourceDTO.ColumnName, new List <ActivityResourceMappingDTO>()); } dicActivityResourceMappingDTO[objActivityResourceDTO.ColumnName].Add(objActivityResourceDTO); } objLoginUserDetails.ActivityResourceMapping = dicActivityResourceMappingDTO; objLoginUserDetails.DocumentDetails = new Dictionary <string, DocumentDetailsDTO>(); //set login user details into session Common.Common.SetSessionValue(ConstEnum.SessionValue.UserDetails, objLoginUserDetails); Common.Common.WriteLogToFile("Update session with login user details ", System.Reflection.MethodBase.GetCurrentMethod()); //This will update the login time for the user. So this should be done after setting the Lastlogin time in the session object. objUserInfoSL.UpdateUserLastLoginTime(objLoginUserDetails.CompanyDBConnectionString, objLoginUserDetails.UserName); // user is login sucessfully, set validation value set in session and cookies to indicate user is login Common.Common.SetSessionAndCookiesValidationValue(objLoginUserDetails.UserName);//set session validation keys Common.Common.WriteLogToFile("Set login user name into session and cookies values", System.Reflection.MethodBase.GetCurrentMethod()); //get new cookies value after login //string cookies_value = Common.Common.GetSessionValue(ConstEnum.SessionValue.CookiesValidationKey).ToString(); //set cookies //filterContext.HttpContext.Response.Cookies[ConstEnum.CookiesValue.ValidationCookies].Value = cookies_value; //filterContext.HttpContext.Response.Cookies[ConstEnum.CookiesValue.ValidationCookies].Path = HttpContext.Current.Request.ApplicationPath; using (SessionManagement sessionManagement = new SessionManagement()) { sessionManagement.CheckCookiesSessions(objLoginUserDetails, true, (System.Web.HttpRequest)System.Web.HttpContext.Current.Request, (System.Web.HttpResponse)System.Web.HttpContext.Current.Response, string.Empty); sessionManagement.BindCookiesSessions(objLoginUserDetails, true, (System.Web.HttpRequest)System.Web.HttpContext.Current.Request, (System.Web.HttpResponse)System.Web.HttpContext.Current.Response, string.Empty); } Common.Common.WriteLogToFile("Set cookies to response to send back to browser ", System.Reflection.MethodBase.GetCurrentMethod()); }