예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["LoginStatus"].ToString() == "False")
                {
                    Response.Redirect("~/Login Pages/login.aspx");
                }
                else
                {
                    Session["LoginStatus"] = "True";
                }
            }
            catch
            {
                Response.Redirect("~/Login Pages/login.aspx");
            }
            NavButtons nav = (NavButtons)LoadControl("NavButtons.ascx");

            headerButtons.Controls.Add(nav);

            if (!IsPostBack)
            {
                loadPosts();
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)

        {
            if (!IsPostBack)
            {
                Encrypt encrypt = new Encrypt();
                //ProfilePicture.ImageUrl = "../ProfilePictures/person1.jpg";

                HttpCookie userCookie = Request.Cookies["UserCookie"];

                WebRequest request = WebRequest.Create("http://localhost:49241/api/MyProfile?" + "loginID=" + encrypt.Decrypt(userCookie.Values["Username"].ToString()) + "&Password="******"Password"].ToString()));

                WebResponse response = request.GetResponse();



                // Read the data from the Web Response, which requires working with streams.

                Stream theDataStream = response.GetResponseStream();

                StreamReader reader = new StreamReader(theDataStream);

                string data = reader.ReadToEnd();

                reader.Close();

                response.Close();

                // Deserialize a JSON string

                User profileData = JsonConvert.DeserializeObject <User>(data);

                txtProfileName.Text      = profileData.Name;
                txtProfileCellPhone.Text = profileData.PhoneNumber;
                txtProfileAddress.Text   = profileData.Address;
                txtProfileCity.Text      = profileData.City;
                txtProfileState.Text     = profileData.State;
                txtProfileZipCode.Text   = profileData.ZipCode.ToString();
                txtProfileOrgs.Text      = profileData.Organization;
                imgProfile.ImageUrl      = profileData.ProfilePictureURL;

                loadPosts();
            }

            NavButtons nav = (NavButtons)LoadControl("NavButtons.ascx");

            headerButtons.Controls.Add(nav);
        }