protected void saveNote_Click(object sender, EventArgs e) { string passwordResetSessionValue = ""; string usernameValue = ""; try { HttpCookie passwordResetSessionCookie = new HttpCookie("passwordResetSession"); passwordResetSessionCookie = Request.Cookies["passwordResetSession"]; passwordResetSessionValue = passwordResetSessionCookie.Value.ToString(); } catch (Exception) { passwordResetSessionValue = "cookie exception"; } if (passwordResetSessionValue != "" && passwordResetSessionValue != "cookie exception") { Response.Cookies["passwordResetSession"].Expires = DateTime.Now.AddMinutes(-2); } try { HttpCookie myCookie = new HttpCookie("userSession"); myCookie = Request.Cookies["userSession"]; usernameValue = myCookie.Value.ToString(); } catch (Exception) { usernameValue = "cookie exception"; } if (usernameValue != "" && usernameValue != "cookie exception") { Controllers.RequestPersonalInformation importRequestPersonalInformation = new Controllers.RequestPersonalInformation(); Controllers.RequestNoteTaker importRequestNoteTaker = new Controllers.RequestNoteTaker(); string subject = this.subject.Text; string yourNote = this.yourNote.Text; this.webPageBodyLoggedIn.Visible = true; this.webPageBodyNotLoggedIn.Visible = false; this.welcomeMessage.Text = importRequestPersonalInformation.requestWelcomeMessage(usernameValue); this.saveNoteMessage.Text = importRequestNoteTaker.requestAddNote(subject, yourNote, usernameValue); if (importRequestNoteTaker.requestSearchNumberOfRecords(usernameValue) < 1) { this.searchSection.Visible = false; } else { this.searchSection.Visible = true; } if (importRequestPersonalInformation.requestWelcomeMessage(usernameValue) == "<label>Hi, username not found!</label>\n") { Response.Cookies["userSession"].Expires = DateTime.Now.AddDays(-14); Response.Redirect("http://www.timothysdigitalsolutions.somee.com/"); } } }
protected void Page_Load(object sender, EventArgs e) { string passwordResetSessionValue = ""; string usernameValue = ""; try { HttpCookie passwordResetSessionCookie = new HttpCookie("passwordResetSession"); passwordResetSessionCookie = Request.Cookies["passwordResetSession"]; passwordResetSessionValue = passwordResetSessionCookie.Value.ToString(); } catch (Exception) { passwordResetSessionValue = "cookie exception"; } if (passwordResetSessionValue != "" && passwordResetSessionValue != "cookie exception") { Response.Cookies["passwordResetSession"].Expires = DateTime.Now.AddMinutes(-2); } try { HttpCookie myCookie = new HttpCookie("userSession"); myCookie = Request.Cookies["userSession"]; usernameValue = myCookie.Value.ToString(); } catch (Exception) { usernameValue = "cookie exception"; } if (usernameValue != "" && usernameValue != "cookie exception") { Controllers.RequestPersonalInformation importRequestPersonalInformation = new Controllers.RequestPersonalInformation(); Controllers.RequestNoteTaker importRequestNoteTaker = new Controllers.RequestNoteTaker(); string requestId = Request.QueryString["id"]; int numberReturned = 0; this.webPageBodyLoggedIn.Visible = true; this.webPageBodyNotLoggedIn.Visible = false; this.welcomeMessage.Text = importRequestPersonalInformation.requestWelcomeMessage(usernameValue); if (!(String.IsNullOrWhiteSpace(requestId))) { numberReturned = importRequestNoteTaker.requestSearchNumberOfRecords(usernameValue, requestId); } if (importRequestNoteTaker.requestSearchNumberOfRecords(usernameValue) < 1) { this.searchSection.Visible = false; } else { if (numberReturned != 1) { this.searchSection.Visible = true; } else { this.searchSection.Visible = false; } } if (numberReturned != 1) { this.addNotesSection.Visible = true; this.yourNoteFocus.Visible = false; this.noteTakerForm.Action = "http://www.timothysdigitalsolutions.somee.com/note-taker/"; } else { this.addNotesSection.Visible = false; this.yourNoteFocus.Visible = true; this.noteTakerForm.Action = HttpContext.Current.Request.Url.AbsoluteUri; } if (importRequestPersonalInformation.requestWelcomeMessage(usernameValue) == "<label>Hi, username not found!</label>\n") { Response.Cookies["userSession"].Expires = DateTime.Now.AddDays(-14); Response.Redirect("http://www.timothysdigitalsolutions.somee.com/"); } } else { this.webPageBodyLoggedIn.Visible = false; this.webPageBodyNotLoggedIn.Visible = true; } }