protected void Page_Load(object sender, EventArgs e) { var lpg = ((IObjCache)System.Web.HttpContext.Current.Cache.Get("Lpg")); var LoginP = ""; if (lpg == null) { LoginP = Usr.LoginPage(); } else { LoginP = lpg.Pages.Count() > 0 ? Usr.RUrl(lpg.Pages.First()) : Usr.LoginPage(); } StringBuilder sb = new StringBuilder(); sb.Append("<script language='javascript'>"); sb.Append("var x=alert('Acceso Denegado - Su Usuario no cuenta con los permisos Requeridos.');"); sb.Append("var r = confirm('Aceptar: Login - Cancelar: Pagina Anterior');"); sb.Append("if (r == true){window.location = '" + LoginP + "';}else{window.history.back(-1);}"); sb.Append("</script>"); if (!ClientScript.IsStartupScriptRegistered("JSScript")) { ClientScript.RegisterStartupScript(base.GetType(), "JSScript", sb.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { Session["Usr"] = null; FormsAuthentication.SignOut(); HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, ""); //cookie1.Expires = DateTime.Now.AddYears(-1); Response.Cookies.Add(cookie1); Cache.Remove("Lpg"); string myHost = System.Net.Dns.GetHostName(); for (var i = 0; i < System.Net.Dns.GetHostEntry(myHost).AddressList.Count(); i++) { var myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[i].ToString(); if (!HttpContext.Current.Request.Url.Host.ToLower().Contains(myIP)) { continue; } Response.Redirect(Usr.LoginPage()); break; } if (HttpContext.Current.Request.Url.Host == myHost) { Response.Redirect(Usr.LoginPage()); } if (IsPostBack) { return; } foreach (var p in PaisServI.Instance.LoadActive()) { ddlPa.Items.Add(new ListItem(p.NPais, p.IdPais.ToString())); } ddlPa.DataBind(); }