protected void Page_Load(object sender, System.EventArgs e) { string hash = Request.QueryString["hash"] as string; string screen = Request.QueryString["scr"] as string; string to = Request.QueryString["to"] as string; if ((hash != null) && (hash.Length >= 0)) { WebmailSettings settings = (new WebMailSettingsCreator()).CreateWebMailSettings(); TempRow row = null; DbStorage storage = DbStorageCreator.CreateDatabaseStorage(null); try { storage.Connect(); row = storage.GetTempRow(-1, string.Format(@"sessionHash_{0}", hash)); if (row != null) { storage.DeleteTempRow(row.ID); } else { throw new WebMailException("Temp Row Is NULL"); } } catch (Exception ex) { Log.WriteException(ex); Response.Redirect(@"../default.aspx", true); } finally { storage.Disconnect(); } if (row != null) { Account acct = Account.LoadFromDb(row.IDAcct, -1, false); if (Session[Constants.sessionAccount] == null) { Session.Add(Constants.sessionAccount, acct); } else { Session[Constants.sessionAccount] = acct; } if (Session[Constants.sessionUserID] == null) { Session.Add(Constants.sessionUserID, acct.IDUser); } else { Session[Constants.sessionUserID] = acct.IDUser; } WMStartPage page = WMStartPage.Mailbox; try { short scrNum = short.Parse(screen); page = (WMStartPage)scrNum; } catch {} switch (page) { case WMStartPage.NewMessage: if (to != null) { to = string.Format(@"&to={0}", to); } goto default; case WMStartPage.Settings: goto default; case WMStartPage.Contacts: goto default; case WMStartPage.Mailbox: goto default; case WMStartPage.Calendar: goto default; default: string check = string.Empty; if (acct.GetMailAtLogin) { check = "check=1&"; } HttpContext.Current.Response.Redirect(string.Format(@"../webmail.aspx?" + check + @"start={0}{1}", (int)page, to)); break; } } } }