Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8977501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:23:04+00:00 2026-06-15T19:23:04+00:00

We create a uniquely named request for an image (jpg), and we need to

  • 0

We create a uniquely named request for an image (jpg), and we need to redirect it and collect what its requested name was. We tried doing this in Global.asax and it works great in Dev, but in production it seem to not fire.

It has to be an image (request ends in jpg) or some processors between us an the client will strip the request out. This runs in a virtual directory that does very little other than these image requests. MVC is not an option.

Ex. request = domain/Copyright_123456789.jpg
    response =  domain/images/Copyright.jpg
    collect = 123456789 and place in database

Code

    void Application_BeginRequest(object sender, EventArgs e)
    {
        if (Request.AppRelativeCurrentExecutionFilePath.Contains("Copyright_") && Request.AppRelativeCurrentExecutionFilePath.Contains(".jpg"))
        {
            int ADFID = 0;
            string[] ImageNameArray = Request.AppRelativeCurrentExecutionFilePath.Split(new char[] { '_', '.' });
            if (int.TryParse(ImageNameArray[1], out ADFID))
            {
                QueriesTableAdapter SaveView = new QueriesTableAdapter();
                SaveView.FirstQuote_Operations_ClientLeadEmailViews_Save(ADFID);
            }
            HttpContext.Current.RewritePath("~/images/Copyright.jpg");
        }
    }

Any help would be much appreciated, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:23:05+00:00Added an answer on June 15, 2026 at 7:23 pm

    Here is how I accomplished this. The image src=”website/this virtual directory/Copyright_12345.jpg”
    12345 is the value we collect, and we respond with a real jpg on our site

    web.config

    <httpHandlers>
        <remove verb="*" path="*.jpg"/>
        <add verb="*" path="*.jpg" type="Tracker.TrackerClass" validate="false"/>
    </httpHandlers>
    

    The tracker class

        public class TrackerClass : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            int ADFID = 0;
            string[] ImageNameArray = context.Request.AppRelativeCurrentExecutionFilePath.Split(new char[] { '_', '.' });
            if (int.TryParse(ImageNameArray[1], out ADFID))
            {
                **store to database***
            }
    
            context.Response.ContentType = "image/jpg";
            context.Response.WriteFile("images/Copyright.jpg");
        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    

    This is the only class in the website. Create a virtual Directory in IIS for this to live.
    Once created, got properties, virtual directory, configuration, mapping. Under Application Extensions hit Add. Enter .jgp, your .NET version isapii (copy it from most any other extension in the window), and set the Verb to All. MAKE SURE TO UNCHECK VERIFY FILE at the bottom.

    That should do it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing a module in an application where I need to create a
CREATE OR REPLACE FUNCTION layer2layerAttribute RETURN VARCHAR2 AS /** * This function properly joins
create table ImagenesUsuario { idImagen int primary key not null IDENTITY } This doesn't
I am using Flot to create graphs. This is my Code here jsFiddle code
a model with a uniquely indexed column Does this mean just a model and
I need to create a token to appear on a querystring that can be
I need to uniquely identify messages in my app. Thus each message should contain
I am trying to create this controller: def calculate # Do some calculations here
So I need to reference particular subdocuments uniquely from items in my collection. For
This seems like a simple question on its surface but I thought I'd reach

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.