/// <summary> /// Override onInit Base Page: Setto di dafault It /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { objDictionary = new Dizionario(); objTestiPagine = new TestiPagine(); objUtilita = new Utilita(); qNAZ_ID_NAZIONE = 1;//it Session["NAZ_ID_NAZIONE"] = 1; switch (qNAZ_ID_NAZIONE) { case 1: qCultureInfoName = "it"; break; case 3: qCultureInfoName = "en"; break; default: qCultureInfoName = "it"; break; } objDizionarioUI = objDictionary.GetDictionary(qNAZ_ID_NAZIONE); objTestiPagineUI = objTestiPagine.GetTestipagina(Page.GetType().BaseType.Name, qNAZ_ID_NAZIONE); objUtilita.Naz_id_nazione = qNAZ_ID_NAZIONE; getCulture(); //objSistema.Read(); if (Page.Header != null) { this.Title = GetValueDizionarioUI("NOME_APPLICAZIONE"); } base.OnInit(e); }
/// <summary> /// Override onInit Base Page: Controllo Sessioni /// </summary> /// <param name="e"></param> protected override void OnInit(EventArgs e) { objDictionary = new Dizionario(); objTestiPagine = new TestiPagine(); objUtilita = new Utilita(); //Utilizzato per i permessi di accesso try { //Controllo se l'utente è autenticato if (!User.Identity.IsAuthenticated) { Exception ex = new Exception("Unauthenticated user. Please log in."); throw ex; } //Controllo se ci sono delle variabili in Session if (Session.Count == 0) { Exception ex = new Exception("Session Timed Out. Please log in again."); throw ex; } idLoggedUser = Convert.ToInt32(Session["UTE_ID_UTENTE"]); } catch (Exception ecc) { string strERROR = ecc.Message.Replace("'", ""); // Gestione messaggistica all'utente e trace in DB dell'errore ExceptionPolicy.HandleException(ecc, "Propagate Policy"); Response.Write(@"<script type='text/javascript'> try { if(window.opener) { if(window.opener.parent.frames) window.opener.parent.frames.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; else window.opener.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; self.close(); } else { if(parent.frames) parent.frames.document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; else document.location.href='../Login/frm_LGN.aspx?ERROR=" + strERROR + @"'; } } catch(e) { self.close(); } </script>"); Response.End(); } //Spostato da PageLoad INIZIO ---------------------- if (Session["NAZ_ID_NAZIONE"] != null) { qNAZ_ID_NAZIONE = Convert.ToInt32(Session["NAZ_ID_NAZIONE"]); } else { qNAZ_ID_NAZIONE = Convert.ToInt32(Request.QueryString["NAZ_ID_NAZIONE"]); } switch (qNAZ_ID_NAZIONE) { case 1: qCultureInfoName = "it"; break; case 3: qCultureInfoName = "en"; break; default: qCultureInfoName = "it"; break; } dizionarioPermessi = (Dictionary <string, int>)Session["dizionarioPermessi"]; objDizionarioUI = objDictionary.GetDictionary(qNAZ_ID_NAZIONE); objTestiPagineUI = objTestiPagine.GetTestipagina(Page.GetType().BaseType.Name, qNAZ_ID_NAZIONE); objUtilita.Naz_id_nazione = qNAZ_ID_NAZIONE; getCulture(); if (Page.Header != null) { this.Title = GetValueDizionarioUI("NOME_APPLICAZIONE"); } base.OnInit(e); }