protected void Page_Load(object sender, EventArgs e) { u = Membership.GetUser(); //display username userLabel.Text = u.UserName; //display email userEmail.Text = u.Email; //display public profile link string url = HttpContext.Current.Request.Url.Scheme + System.Uri.SchemeDelimiter + HttpContext.Current.Request.Url.Host + (HttpContext.Current.Request.Url.IsDefaultPort ? "" : ":" + HttpContext.Current.Request.Url.Port); publicLink.NavigateUrl = url + "/user/" + u.UserName; publicLink.Text = url + "/user/" + u.UserName; //set gravatar AvatarImage.ImageUrl = "/getavatar.ashx?user="******"&size=200"; //set user bio FuddleUser account = new FuddleUser(u.UserName); aboutmeLabel.Text = account.getBio(); if (!IsPostBack) { //get user uploads uploads = account.getuploads(); //Displays user uploads upload_index = 5; loadUploads(); } //Load albums if (table_state == 0) { album_index = 2; loadAlbums(); } //Load cuddles if (table_state == 1) { cuddle_index = 2; loadCuddles(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //get the requested user string user = Request.QueryString["user"]; //member user MembershipUser u = null; //if no parameter is given redirect to 404 if (user == null || user == "") { Response.Redirect("/Oops.aspx?e=404"); } //if a user is specified in the url with "user=username" //find the specific user in database else { u = Membership.GetUser(user); } //if found, fill the page if (u != null) { //display username userLabel.Text = u.UserName; //set the title of the page Page.Header.Title = "Fuddle | " + CultureInfo.CurrentCulture.TextInfo.ToTitleCase(u.UserName.ToString().ToLower()); //set gravatar AvatarImage.ImageUrl = "getavatar.ashx?user="******"&size=200"; //set user bio FuddleUser account = new FuddleUser(u.UserName); aboutmeLabel.Text = account.getBio(); //get user uploads uploads = account.getuploads(); //get user cuddles cuddles = FuddleVote.getCuddles((Guid)u.ProviderUserKey); //Displays user uploads upload_index = 5; loadUploads(); //Display Album albums = FuddleAlbum.getAllAlbums((Guid) u.ProviderUserKey); album_index = 2; loadAlbums(); } //if not found, direct to 404 else { Response.Redirect("/Oops.aspx?e=404"); } } }