title: Redirect to Static file asp.net core
body: <p>I'm developing an application that contains Images under the wwwroot folder. When the image is called (something.com/Images/img.png) I need a code to run, after finishing I need the image to appear. Is it possible after the code is executed to redirect the pipe line to static file (image). 
  my code looks like this: </p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
     app.Map("/images", images =&gt;
     {
        images.Map("/img.png=", img =&gt;
        {
           HandleImages(app);
        });
     });
  }
  
  private void HandleImages(IApplicationBuilder app)
  {
     app.Run(async (context) =&gt;
     {
        //do something
        //redirect to The Image 
     });
  }
  </code></pre>
  
  <p>I tried using <code>app.UseStaticFiles();</code> the image appeared but the code isn't executed.</p>