public ActionResult UserAuthenticate(FormCollection frm) { try { Int32 userID = Convert.ToInt32(frm["userID"]); String key = frm["key"]; String LoginID = frm["LoginID"]; String Password = frm["password"]; String BusinessName = frm["BusinessName"]; Boolean isLoginIDExist = userUtil.IsLoginIDExist(LoginID) == null ? false : true; if (!isLoginIDExist) { var userInfo = db.users.AsEnumerable().Where(x => x.user_id == userID && x.activation_reset_key == key && x.is_active == false).FirstOrDefault(); if (userInfo != null) { userUtil.ActivateUser(userID, key, LoginID, Password, BusinessName); String LoginResult = RoleUtil.CheckUserFrofile("", "", userInfo.user_id); if (LoginResult == "PASS") { var list = RoleUtil.GetMenusOfRoleId(Convert.ToInt32(STUtil.GetSessionValue(UserInfo.RoleID.ToString())), Convert.ToInt32(STUtil.GetSessionValue(UserInfo.CompanyID.ToString()))).ToList(); var menuObjects = (Session[UserInfo.MenuList.ToString()] as List <TreeNode>) ?? new List <TreeNode>(); menuObjects.AddRange(list); Session[UserInfo.MenuList.ToString()] = menuObjects; return(RedirectToAction("Index/", "DashBoard")); } } else { ViewBag.result = "Invalid Request"; } } else { ViewBag.result = "LoginID '" + LoginID + " already exist!!"; } } catch (Exception ex) { ViewBag.result = ex.Message; return(RedirectToAction("Login", "Account", new { result = ex.Message, MessageType = "Error" })); } return(View()); }