Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var query = Request.Url.Query;

            if (IsNullOrWhiteSpace(query))
            {
                Utility.Signal404();
            }
            var info = Server.UrlDecode(query.Substring(1))?.Split('.');

            Debug.Assert(info != null, nameof(info) + " != null");
            var orgId = 0;

            if (info.Length < 1 || !int.TryParse(info[0], out orgId))
            {
                Utility.Signal404();
            }

            var blob = Organizations.GetAdImage(orgId);

            if (blob == null)
            {
                Utility.Signal404();
            }
            AdImageDefaultPage.ServeImage(blob);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var query = Request.Url.Query;

            if (IsNullOrWhiteSpace(query))
            {
                Utility.Signal404();
            }
            var info = Server.UrlDecode(query.Substring(1))?.Split('.');

            Debug.Assert(info != null, nameof(info) + " != null");
            if (info.Length < 1)
            {
                Utility.Signal404();
            }
            var adType      = info[0];
            var stateCode   = info.Length >= 2 ? info[1] : Empty;
            var electionKey = info.Length >= 3 ? info[2] : Empty;
            var officeKey   = info.Length >= 4 ? info[3] : Empty;

            var blob = BannerAds.GetAdImage(adType, stateCode, electionKey, officeKey);

            if (blob == null)
            {
                Utility.Signal404();
            }
            AdImageDefaultPage.ServeImage(blob);
        }