public ActionResult EditProfile() { UserSession userSessionMgr = (UserSession)Session[SessionManagement.Constants.UserSessionMgr]; if (userSessionMgr == null) // we were not signed on yet { return(RedirectToAction(Constants.SignOn, Constants.Account, Constants.Admin)); } if (userSessionMgr.IsAccessAllowed(Constants.UIControlCode_AdminEditProfile_Code)) { DataAccessMgr daMgr = Global.GetDataAccessMgr(this.HttpContext); DbCommand dbCmd = UserMaster.GetUserMasterCmd(daMgr); dbCmd.Parameters[daMgr.BuildParamName(DataManagement.Constants.UserId)].Value = this.HttpContext.User.Identity.Name; EditProfileModel profileData = daMgr.ExecuteCollection <EditProfileModel>(dbCmd, null).First(); return(View(Constants._Page_EditProfile, profileData)); } ViewBag.Status = "Insufficient privileges for the action." + Request.Url; string referUrl = Request.QueryString[Constants.UrlReferrer]; System.Web.Routing.RouteValueDictionary dictionary = new System.Web.Routing.RouteValueDictionary(); dictionary.Add(Constants.UrlReferrer, referUrl); return(RedirectToAction(Constants.AccessDenied, Constants.Home, dictionary)); }