protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["mail"] == "true" && Request.QueryString["uname"] != null) { } else if ((Session["Username"] == null && Session["Guest"] == null && Request.QueryString["mail"] == null) || (Session["Username"] == null && Session["Guest"] == null && Request.QueryString["mail"] != null)) { Response.Redirect("Login.aspx"); } else if ((Session["Guest"] != null || Session["Username"] != null) && Request.QueryString["mail"] == null) { Response.Redirect("Home.aspx"); } else if (Session["Guest"] != null && Request.QueryString["mail"] != null) { Response.Redirect("Home.aspx"); } string username; string mail = Request.QueryString["mail"].ToString(); if (mail == "true") { if (Request.QueryString["uname"] == null) { Response.Redirect("Verification.aspx?mail=false"); } pAppVerify.Visible = false; btnLogout.Visible = false; pVerified.Visible = false; btnLogin.Visible = false; username = Request.QueryString["uname"].ToString(); } else { pEmailVerify.Visible = false; btnVerifyUser.Visible = false; pVerified.Visible = false; btnLogin.Visible = false; username = Session["Username"].ToString(); } h5Username.InnerText = "Username: "******"Username"] != null) { Response.Redirect("Home.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Username"] == null && Session["Guest"] == null) { Response.Redirect("Login.aspx"); } if (Session["Guest"] != null) { Response.Redirect("Home.aspx"); } if (Session["Username"] != null) { currentUsername = Session["Username"].ToString(); UserService.UserService proxy = new UserService.UserService(); bool verified = proxy.IsUserVerified(currentUsername); if (!verified) { Response.Redirect("Verification.aspx?mail=false"); } } List <TwitterClassLibrary.Models.PrivateMessage> usersPms = new List <TwitterClassLibrary.Models.PrivateMessage>(); usersPms = DBSerialize.ReadSerializedPM(currentUsername); if (usersPms.Count == 0) { lblRepeaterMessage.Text = "You don't have any private messages!"; } else { repeaterPMs.DataSource = usersPms; repeaterPMs.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Username"] == null && Session["Guest"] == null) { Response.Redirect("Login.aspx"); } if (Session["Username"] != null) { lblUserInfo.Text = "@" + Session["Username"].ToString(); lnkBtnLogin.Visible = false; string username = Session["Username"].ToString(); UserService.UserService proxy = new UserService.UserService(); bool verified = proxy.IsUserVerified(username); if (!verified) { Response.Redirect("Verification.aspx?mail=false"); } } if (Session["Guest"] != null) { lnkBtnLogout.Visible = false; lnkMyProfile.Visible = false; lblUserInfo.Visible = false; lnkPMs.Visible = false; } InitializeWebAssets(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Username"] == null && Session["Guest"] == null) { Response.Redirect("Login.aspx"); } if (Session["Username"] != null) { string username = Session["Username"].ToString(); UserService.UserService proxy = new UserService.UserService(); bool verified = proxy.IsUserVerified(username); if (!verified) { Response.Redirect("Verification.aspx?mail=false"); } } Exception ex = null; if (Session["Username"] != null) { currentUsername = (string)Session["Username"]; List <(string, dynamic, Type)> filter = new List <(string, dynamic, Type)>(); filter.Add(DBObjCreator.CreateFilter("Username", currentUsername, typeof(string))); List <object[]> records = DBObjCreator.ReadDBObjsWithWhere("TP_GetUser", ref ex, filter); List <User> newUser = new List <User>(); records.ForEach(r => newUser.Add(DBObjCreator.CreateObj <User>(r, typeof(User)))); currentUser = newUser[0]; Session["CurrentUserObj"] = currentUser; } if (!IsPostBack) { Session["AdvSearch"] = false; if (Session["Username"] != null) { Greeting.InnerText = "All Posts"; InitializeTrendingList(); InitializeFollowList(); InitializeAllPostsList(); repeaterFollow.Visible = false; Session["CurrentView"] = ALL; } if (Session["Guest"] != null) { Greeting.InnerText = "All Posts"; InitializeAllPostsList(); InitializeTrendingList(); btnFollowPosts.Visible = false; Session["CurrentView"] = ALL; divCreateComment.Visible = false; btnNewPost.Visible = false; } } SetupPostCardEvents(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Username"] == null && Session["Guest"] == null) { Response.Redirect("Login.aspx"); } if (Session["Guest"] != null) { Response.Redirect("Home.aspx"); } if (Session["Username"] != null) { string username = Session["Username"].ToString(); UserService.UserService proxy = new UserService.UserService(); bool verified = proxy.IsUserVerified(username); if (!verified) { Response.Redirect("Verification.aspx?mail=false"); } } if (!IsPostBack) { string username = Session["Username"].ToString(); UserService.UserService proxy = new UserService.UserService(); UserService.User proxyUser = proxy.GetUser(username); User user = new User(proxyUser.Username, proxyUser.FirstName, proxyUser.LastName, proxyUser.Password, proxyUser.ProfileImage, proxyUser.HomeAddress, proxyUser.BillingAddress, proxyUser.EmailAddress, proxyUser.Phone, proxyUser.SecretQuestions, proxyUser.SecretAnswers, proxyUser.Verified); imgProfileImage.ImageUrl = user.ProfileImage; lblUsername.InnerText = user.Username; lblFirstName.InnerText = user.FirstName; lblLastName.InnerText = user.LastName; lblEmail.InnerText = user.EmailAddress; lblPhone.InnerText = user.Phone; lblHomeAddress.InnerText = user.HomeAddress; lblBillingAddress.InnerText = user.BillingAddress; string[] questions = user.SecretQuestions.Split(','); lblSecurityQuestion1.InnerText = securityQuestions[Int32.Parse(questions[0])]; lblSecurityQuestion2.InnerText = securityQuestions[Int32.Parse(questions[1])]; lblSecurityQuestion3.InnerText = securityQuestions[Int32.Parse(questions[2])]; // Getting Posts string url = "https://localhost:44312/api/User/GetUserPosts/" + username; WebRequest request = WebRequest.Create(url); WebResponse response = request.GetResponse(); Stream stream = response.GetResponseStream(); StreamReader reader = new StreamReader(stream); String data = reader.ReadToEnd(); JavaScriptSerializer js = new JavaScriptSerializer(); List <Post> posts = js.Deserialize <List <Post> >(data); RepeaterPosts.DataSource = posts; RepeaterPosts.DataBind(); if (posts.Count == 0) { h5NoPosts.Visible = true; } stream.Close(); reader.Close(); // Getting Follow count string url2 = "https://localhost:44312/api/Follow/GetFollowCount/" + username; WebRequest request2 = WebRequest.Create(url2); WebResponse response2 = request2.GetResponse(); Stream stream2 = response2.GetResponseStream(); StreamReader reader2 = new StreamReader(stream2); String data2 = reader2.ReadToEnd(); btnFollowing.Text = "Following " + data2; stream2.Close(); reader2.Close(); // Getting Follower count string url3 = "https://localhost:44312/api/Follow/GetFollowerCount/" + username; WebRequest request3 = WebRequest.Create(url3); WebResponse response3 = request3.GetResponse(); Stream stream3 = response3.GetResponseStream(); StreamReader reader3 = new StreamReader(stream3); String data3 = reader3.ReadToEnd(); btnFollowers.Text = data3 + " Followers"; stream3.Close(); reader3.Close(); } SetupPostCardEvents(); }
protected void btnSubmitLogin_Click(object sender, EventArgs e) { string username = txtLogUsername.Text; string password = txtLogPassword.Text; bool good = true; if (username == "") { smlLogUsernameHelp.InnerText = "Please enter your username"; good = false; } else { smlLogUsernameHelp.InnerText = ""; } if (password == "") { smlLogPasswordHelp.InnerText = "Please enter your password"; good = false; } else { smlLogPasswordHelp.InnerText = ""; } if (!good) { return; } UserService.UserService proxy = new UserService.UserService(); bool verify = proxy.ValidateUser(username, password); if (!verify) { smlLogPasswordHelp.InnerText = "Username or password is incorrect, try again"; return; } else { smlLogPasswordHelp.InnerText = ""; } Session["Username"] = txtLogUsername.Text; if (chkLoginCookie.Checked) { Response.Cookies["Username"].Value = txtLogUsername.Text; } bool verified = proxy.IsUserVerified(username); if (!verified) { Response.Redirect("Verification.aspx?mail=false"); } else { Response.Redirect("Home.aspx"); } }