private void Page_Load(object sender, System.EventArgs e) { this.proc.Text = " Attenzione: <br><br> procedura di "; Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; this.btn_chiudi.Attributes.Add("onClick", "window.close();"); this.lbl_mgserrore.Text = ""; string proc = Request.QueryString["nome_proc"]; if (proc != null && !proc.Equals("")) { this.proc.Visible = false; this.proc.Text = this.proc.Text + " " + Server.UrlDecode(proc.ToUpper()) + " non effettuata."; } else { this.proc.Visible = false; } if (Session["ErrorManager.error"] == null) //altrimenti se errore prima del login c'è il loop eterno! { if (!(Session != null && Session["userData"] != null)) { ErrorManager.redirectToLoginPage(this); } else { string msg = (string)Session["ErrorManager.error"]; this.lbl_mgserrore.Text = msg; Session.Remove("ErrorManager.error"); } } else { string msg = (string)Session["ErrorManager.error"]; this.lbl_mgserrore.Text = this.lbl_mgserrore.Text + "<BR>" + msg; Session.Remove("ErrorManager.error"); } if ((string)Session["noruolo"] == "" || Session["noruolo"] == null) { } else { this.lbl_mgserrore.Text = (string)Session["noruolo"]; Session["noruolo"] = ""; } }
private void Page_Load(object sender, System.EventArgs e) { // Solo nel caso in cui non si è in postback bisogna eseguire // la verififca dell'errore if (!Page.IsPostBack) { // Se la sessione esiste ancora... if (Session != null) { // ...allora di procede con l'identificazione della // tipologia di errore. // Se si è nel caso in cui è stato impostato il ruolo... if (!String.IsNullOrEmpty((string)Session["noruolo"])) { // ...si scrive nella label la descrizione this.lbl_mgserrore.Text = Session["noruolo"].ToString(); // ...e si rumuove dalla sessione noruolo Session.Remove("noruolo"); } else // ...altrimenti si vede se ErrorManager.error // è valido... if (!String.IsNullOrEmpty((string) Session["ErrorManager.error"])) { // ...si costruisce la descrizione dettagliata // dell'errore e la si stampa nel log logger.Error(this.GetErrorDetails((string)Session["ErrorManager.error"])); } else // ...altrimenti se userData è valido... if (Session["userData"] != null) { // ...si redirezione l'utente alla pagina di login ErrorManager.redirectToLoginPage(this); } else { // ...altrimenti si indica che non è stato // possibile identificare l'errore logger.Error(this.GetErrorDetails("Errore non identificato")); } } } }