protected void Page_Load(object sender, EventArgs e) { SharedDataEncryptor ec = new SharedDataEncryptor("mfb"); string szEncrypted = ec.Encrypt(Page.User.Identity.Name); lnkGeneric.NavigateUrl = String.Format(System.Globalization.CultureInfo.InvariantCulture, "http://{0}{1}?uid={2}", Branding.CurrentBrand.HostName, ResolveUrl("~/Public/RSSCurrency.aspx"), HttpUtility.UrlEncode(szEncrypted)); }
protected void Page_Load(object sender, EventArgs e) { this.Master.SelectedTab = tabID.tabHome; PageSize = 15; // figure out who to show if (!IsPostBack) { IEnumerable <LogbookEntry> rgle = Array.Empty <LogbookEntry>(); string szUserEnc = util.GetStringParam(Request, "uid"); UserName = string.Empty; if (!String.IsNullOrEmpty(szUserEnc)) { SharedDataEncryptor enc = new SharedDataEncryptor(MFBConstants.keyEncryptMyFlights); UserName = enc.Decrypt(szUserEnc); } if (String.IsNullOrEmpty(UserName)) { FlightStats fs = FlightStats.GetFlightStats(); List <LogbookEntry> lst = new List <LogbookEntry>(fs.RecentPublicFlights); if (lst.Count > PageSize) { lst.RemoveRange(PageSize, lst.Count - PageSize); } rgle = lst; } else { try { // below can throw argument null exception if it's an invalid username Profile pf = Profile.GetUser(UserName); if (pf.UserFullName.Length > 0) { lblHeader.Text = String.Format(CultureInfo.CurrentCulture, Resources.LogbookEntry.PublicFlightPageHeader, HttpUtility.HtmlEncode(pf.UserFullName)); } rgle = LogbookEntryBase.GetPublicFlightsForUser(UserName, 0, PageSize); } catch (Exception ex) when(ex is NullReferenceException) { } } gvMyFlights.DataSource = rgle; gvMyFlights.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { this.Master.SelectedTab = tabID.tabHome; PageSize = 15; // figure out who to show if (!IsPostBack) { IEnumerable <LogbookEntry> rgle = new LogbookEntry[0]; string szUserEnc = util.GetStringParam(Request, "uid"); UserName = string.Empty; if (!String.IsNullOrEmpty(szUserEnc)) { SharedDataEncryptor enc = new SharedDataEncryptor(MFBConstants.keyEncryptMyFlights); UserName = enc.Decrypt(szUserEnc); } if (String.IsNullOrEmpty(UserName)) { FlightStats fs = FlightStats.GetFlightStats(); List <LogbookEntry> lst = new List <LogbookEntry>(fs.RecentPublicFlights); if (lst.Count > PageSize) { lst.RemoveRange(PageSize, lst.Count - PageSize); } rgle = lst; } else { Profile pf = MyFlightbook.Profile.GetUser(UserName); if (pf.UserFullName.Length > 0) { lblHeader.Text = String.Format(CultureInfo.CurrentCulture, Resources.LogbookEntry.PublicFlightPageHeader, pf.UserFullName); } rgle = LogbookEntry.GetPublicFlightsForUser(UserName, 0, PageSize); } gvMyFlights.DataSource = rgle; gvMyFlights.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { string szUser = ""; string szDebug = ""; if (Request.Params["uid"] != null) { string szUid = Request.Params["uid"].ToString().Replace(" ", "+"); SharedDataEncryptor ec = new SharedDataEncryptor("mfb"); szUser = ec.Decrypt(szUid); szDebug += "original uid=" + Request.Params["uid"].ToString() + " fixed szUid=" + szUid + " and szUser="******" and timestamp = " + DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString(); } else if (User.Identity.IsAuthenticated) { szUser = User.Identity.Name; szDebug += "Using cached credentials..."; } IsTotals = (util.GetIntParam(Request, "t", 0) != 0); mvData.SetActiveView(IsTotals ? vwTotals : vwCurrency); string szDescription = ""; if (szUser.Length > 0) { StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb, System.Globalization.CultureInfo.CurrentCulture)) { HtmlTextWriter htmlTW = new HtmlTextWriter(sw); if (IsTotals) { mfbTotalSummary.Username = szUser; mfbTotalSummary.CustomRestriction = new FlightQuery(szUser); mfbTotalSummary.RenderControl(htmlTW); } else { mfbCurrency1.UserName = szUser; mfbCurrency1.RefreshCurrencyTable(); mfbCurrency1.RenderControl(htmlTW); } } szDescription = sb.ToString(); if (!String.IsNullOrEmpty(Request.QueryString["HTML"])) { return; } } else { szDescription = Resources.Currency.RSSNoUser; } XmlTextWriter xmltw = new XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8); Profile pf = MyFlightbook.Profile.GetUser(szUser); szDescription += "\r\n<!-- " + szDebug + "-->"; if (!String.IsNullOrEmpty(Request.QueryString["Google"])) { WrapGoogleRSS(xmltw, pf.UserFullName, szDescription); } else { WrapGenericRSS(xmltw, pf.UserFullName, szDescription); } Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentType = "text/xml"; xmltw.Flush(); Response.End(); }