2

Recently I came across a problem with an Image Button in an ASP.Net application.

The image file was replaced with the same name in the server when user uploads a new Image,but The image button still showed the old Image even after the page was refreshed.

Did Overcome this issue by adding a query string to the ImageButtom url

      Image1.ImageUrl="images/ID102.jpg?"+DateTime.Now.ToString("ddmmyy");

Would like to know if this is the only solution to this??

1
  • Your answer is below for Sergey Latysh. Also if you press CTRL+F5 on your browser to make sure that you clear your browser's cache before you get to the CDN's cache. Commented Jun 17, 2016 at 20:36

3 Answers 3

2

You should include hours, minutes and seconds to resolve caching problem (also you can add random number but not current datetime))

Sign up to request clarification or add additional context in comments.

Comments

0

Your browser was likely caching the old image since it had the same url.

Refresh the page with ctrl+f5 or open up your developer tools and turn off caching in the options.

You can also detect caching by hitting F12 in your browser and looking at the network tab and watching the requests. If you see a "304 Not Modified" it means it's using a cached version.

Comments

0

I always use Google Chrome's Incognito mode to discard any stored cookies/cache while testing my apps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.