/// <summary> /// funció que es crida abans de mostrar el web /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { bool refrescant; Controlador = (controlSessio)Application.Get(this.Session.SessionID); //Controlador = ((Global)this.Context.ApplicationInstance).ObjectesDeDessio[Session.SessionID]; //si ha caducat la session // el redireccionament per session nova ha de fer invalida thisSession part if (Controlador == null) { //Controlador = ((Global)this.Context.ApplicationInstance).renewSession(); ((Global)this.Context.ApplicationInstance).renewSession(); Server.Transfer("start.aspx"); } else { Controlador.sessionList = null; } //carrega les llistes que ara existeixen per pantalla if (!IsPostBack) { refrescant = Controlador.listItemDeXMLs(llistesActives.Items, this.Context); } else { refrescant = tocarefrescar(); } if (refrescant) { Page.ClientScript.RegisterStartupScript(this.GetType(), "refresh", "window.setTimeout('var url = window.location.href;window.location.href = url',5000);", true); } }
/// <summary> /// crea un objecte controlsessió nou segons la sessió actual /// </summary> /// <returns>objecte controlsessió</returns> private controlSessio newObjectForTheActualSession() { controlSessio nouObjecteSessio = new controlSessio(); nouObjecteSessio.idioma = HttpContext.Current.Request.UserLanguages[0]; nouObjecteSessio.sessionList = null; nouObjecteSessio.IpRemota = HttpContext.Current.Request.UserHostAddress; nouObjecteSessio.sessionID = HttpContext.Current.Session.SessionID; return(nouObjecteSessio); }
/// <summary> /// funció que es crida abans de mostrar el web /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { Controlador = (controlSessio)Application.Get(this.Session.SessionID); if (Controlador == null) { ((Global)this.Context.ApplicationInstance).renewSession(); Server.Transfer("start.aspx"); } }
/// <summary> /// Refreshes session object on IIS identified by session id /// </summary> public void renewSession() { controlSessio nou = newObjectForTheActualSession(); if (!developing) { killOtherSessionsOfThisIP(nou.IpRemota, nou.sessionID); } Application[nou.sessionID] = nou; }
protected void Session_Start(object sender, EventArgs e) { controlSessio nou = newObjectForTheActualSession(); if (!developing) { killOtherSessionsOfThisIP(nou.IpRemota, nou.sessionID); } Application[nou.sessionID] = nou; }
/// <summary> /// elimina del servidor la sessió de la que es dona el hash /// </summary> /// <param name="sessionToKill">hash de sessió a matar</param> /// <returns>true si tot ha anat be</returns> public bool killSession(string sessionToKill) { controlSessio thisSession = new controlSessio(); if (thisSession != null) { if (thisSession.xmlExecutant != "") { thisSession.despresScriptAsincron(); } return(true); } return(false); }
/// <summary> /// funció que es crida en polsar el cotó desar, codi principal de la pàgina /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void desar_Click(object sender, EventArgs e) { controlSessio controla = new controlSessio(); if (controla.comprovaValorsPerCrearEstatica(nomNouScript.Text, correusNouScript.InnerText)) { if (!controla.creaLlistaEstatica(nomNouScript.Text, correusNouScript.InnerText)) { labelError.Text = "Error creating file"; } else { labelError.Text = "Created, ok"; } } else { labelError.Text = "Error, Constrains not satisfied: file name end must be PS1, text must ONLY contain mail names, no empty lines allowed"; } }
/// <summary> /// funció que es crida abans de mostrar el web /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Session.IsNewSession) { Server.Transfer("start.aspx"); } Controlador = (controlSessio)Application.Get(this.Session.SessionID); if (Controlador == null) { ((Global)this.Context.ApplicationInstance).renewSession(); Server.Transfer("start.aspx"); } if (Controlador.sessionList == null) { Controlador.sessionList = new flux(); Controlador.scriptEditant = null; parms.Controls.Clear(); Controlador.sessionList.targetMail = targetMailDefaultMessage; } if (!IsPostBack) { refrescaNomIListBoxes(); } else { if (Controlador.scriptEditant != null) { if (Controlador.scriptEditant.parametresObjectes != null) { mostraObjectesParms(Controlador.scriptEditant.input); } } } }