コード例 #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(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);

            Debug.Assert(info != null, nameof(info) + " != null");
            if (info.Length < 3)
            {
                Utility.Signal404();
            }
            var electionKey   = info[0];
            var officeKey     = info[1];
            var politicianKey = info[2];

            var blob = ElectionsPoliticians.GetAdImage(electionKey, officeKey, politicianKey);

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