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 8383333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:08:20+00:00 2026-06-09T17:08:20+00:00

In my app I modify an image based on the users selected options. Each

  • 0

In my app I modify an image based on the users selected options. Each time I modify the default image I save and name it as user’s ID & date.now.tostring("yyyyMMddHHmmssf") to fix my problem with browser caching. This works fine, but now I could potentially end up with a lot of old images hanging around.

Now how can I delete all the images from my ~/Images/Temp/userID folder on the server? I was thinking about using the Session_End or Application_end subs in Global.asax, but I don’t think I can access any of my variables to get the path for the temp images.

How can I delete these temp files after session end or something similar?

  • 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-09T17:08:21+00:00Added an answer on June 9, 2026 at 5:08 pm

    Session End only fires for in-process sessions and it’s not guaranteed (e.g. the server could lose power and it wouldn’t fire). Application End shouldn’t be firing that often and (as you pointed out) you probably wouldn’t have the data you needed to perform the cleanup.

    It’s not bad to perform cleanup work when a session ends, but for this particular problem there may be a better, more deterministic solution.

    If unique naming is the source of the problem, several options come to mind:

    • Use a naming convention which allows you to run a Windows task periodically to identify old images and clean them up. Powershell is pretty flexible for tasks like this.

    • Serve the images with a varying query string parameter at the end of the name to avoid caching (but keep the file name consistent).

      Example: <img src="images/tim-medora.jpg?v=123" alt="picture" />

    • Serve the images dynamically through a handler. This lets you control cache settings, vary the query string, etc.

    • Give the images a custom extension and set different cache settings for that extension in IIS. A web browser will have no problem with an image tag that points to a custom extension as long as its a valid image.

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

Sidebar

Related Questions

I'm writing an simple application for users to upload an image, modify it and
I have a Cocoa Mac image editing app which lets users export JPEG images.
I am making an app for retrieving the image and then modify the image.
I have an app that can make modify images. In some cases, this makes
I am trying to modify an app for a client which has already a
I have to modify a VB6 app and am repeatedly beating my head against
Got a c#.net app which I need to modify. The query at the moment
I found this PHP code in an app I have to modify... $links =
I want to modify something in Settings.secure database, just as the android Settings app
I have an xml file I need to modify: ... </web-app> I want to

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.