[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1099
  • Last Modified:

ASP.net 2.0 fileupload and image overwritting

Hi Experts,

Controls used: Asp file upload control ,asp.net 2.0,IE/Mozilla

 
Newly uploaded Image doesnt appear on the browser window even after refreshing the page, if I upload a different image with the same filename as the previously uploaded one.
 

1)     I have uploaded bipin.jpg to the server and preview displays bipin.jpg

2)     I have changed an existing image rohan.jpg to the server and preview displays rohan.jpg

3)     I have changed the name of rohan.jpg to bipin.jpg and try uploading and now the image displayed in the browser is still that of bipin.jpgs last content.(ideally it should display the photo of rohan as I just changed the image file name of rohans image to bipin)

I have tried with clearing cache in browser as well as in code but didn't work. please can you suggest me the solution for this weired behavior?

Regards,
NetSwap.
0
Swapnil Piparia
Asked:
Swapnil Piparia
1 Solution
 
renjurdevanCommented:
Seems like a cahing problem!! That is when ever you dont hav any change in URL it will show cached image !! To avoid this you can just pass a random number as Querystring!! Better pass GUID as Query string while refering URL

Regards
Renju
0
 
Swapnil PipariaArchitectAuthor Commented:

I have ?t=+ Guid.NewGuid().ToString() appended in URL.

Thanks Renju, It works.

Regards,
NetSwap.
 
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now