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:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.Map("/images", images =>
{
images.Map("/img.png=", img =>
{
HandleImages(app);
});
});
}
private void HandleImages(IApplicationBuilder app)
{
app.Run(async (context) =>
{
//do something
//redirect to The Image
});
}
I tried using app.UseStaticFiles(); the image appeared but the code isn't executed.