protected string DateFormatForDatePicker = System.Configuration.ConfigurationManager.AppSettings["JSDateFormat"];// dd/mm/yy is mandatory in Atharvana // dmm/dd/yy is mandatory in KGN Server //protected int LoggedInUserId //{ // //get // //{ // // if (!LoginRequired) // // throw new InvalidOperationException("Cannot Get UserID for Users Not Logged In!"); // // var fIdent = (FormsIdentity)HttpContext.Current.User.Identity; // // var ticket = (fIdent.Ticket); // // return Convert.ToInt32(Common.GetTicketUserDataWordAt(ticket, 0)); // //} //} #endregion #region Page Events protected override void OnLoad(EventArgs e) { base.OnLoad(e); string SessionuserID = DatabaseName() + "_" + "userid"; if (!LoginRequired) { if (Request.Cookies["udata"] != null) { Request.Cookies["udata"].Expires = DateTime.Now; } if (Request.Cookies[SessionuserID] != null) { Request.Cookies[SessionuserID].Expires = DateTime.Now; Response.Cookies.Add(Request.Cookies[SessionuserID]); } Session.Abandon(); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)); Response.Cache.SetNoStore(); Response.Redirect(String.Format("{0}?ReturnUrl={1}", FormsAuthentication.LoginUrl, Server.UrlEncode(HttpContext.Current.Request.Url.ToString()))); } else { int?userId; CRBusinessLogicLayer.IsValidUserForPage(HttpContext.Current.Request.Cookies["UserName"].Value, HttpContext.Current.Request.Cookies["Pass"].Value, out userId); if (userId == null) { if (Request.Cookies["udata"] != null) { Request.Cookies["udata"].Expires = DateTime.Now; } if (Request.Cookies[SessionuserID] != null) { Request.Cookies[SessionuserID].Expires = DateTime.Now; Response.Cookies.Add(Request.Cookies[SessionuserID]); } Session.Abandon(); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1)); Response.Cache.SetNoStore(); Response.Redirect(String.Format("{0}?ReturnUrl={1}", FormsAuthentication.LoginUrl, Server.UrlEncode(HttpContext.Current.Request.Url.ToString()))); } } if (Request.Cookies[SessionuserID] != null) { //int UserID = Convert.ToInt32(Request.Cookies[SessionuserID].Value); //var resourceGroupAccessDt = StaticCache.GetResourceGroupAccessDt(UserID); //if (resourceGroupAccessDt != null) //{ // if (resourceGroupAccessDt.Rows.Count > 0) // { // for (int i = 0; i < resourceGroupAccessDt.Rows.Count; i++) // { // if (Convert.ToInt32(resourceGroupAccessDt.Rows[i]["ResourceID"]) == ResourceId) // { // hasAccessToThePage = true; // break; // } // } // } //} //else //{ // RedirectToDontHaveAccessPage(); //} } else { Response.Redirect("~/Login.aspx"); } }