1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ASP.NET, How to update image in already sent email?

Discussion in 'C, C++, C#' started by loginname, Sep 19, 2009.

  1. loginname

    loginname Regular Member

    Joined:
    Oct 1, 2008
    Messages:
    371
    Likes Received:
    13
    Hi

    ASP.NET 3.5

    I'm looking for ways to update images in already sent emails.
    I'm creating an email with an image which I host from my webserver. After the email is sent I update the image, then when I view the email again I see the old image.

    The reason for this is AFAIK caching.

    I came across this article: http://dotnetguts.blogspot.com/2009/05/how-to-remove-image-from-cache-when.html

    Which I have this example:
    Code:
    "~/Image/User5.jpg?" + DateTime.Now.ToString("ddyyhhmmss")
    
    But that example will not work for me, as that example contains ASP.NET, I'm instead looking for regular ways to solve it without using DateTime.Now in the tag.

    any ideas?
     
  2. dparker

    dparker Newbie

    Joined:
    Feb 7, 2009
    Messages:
    28
    Likes Received:
    100
    Occupation:
    Software enginner
    Location:
    Canada
    You dont have to use DateTime.Now in the urls. You can simply use a number or letter in the tag.

    "/i/img.jpg?1"

    If you want to update the image and ensure you users always have the latest version instead of a cached image, just change number on the url of the image.

    "/i/img.jpg?2"

    Browsers and AFAIK cache based on the url.

    "/i/img.jpg?1"

    is a different url then

    "/i/img.jpg?2"

    I hope you get the idea.

    But your situation here is a bit different here. AFAIK is a caching service and not a browser. Since you have already sent the email with the url embeded in the email, and AFAIK has already cached it, in my opinion you are SOL in terms of getting the new image to your users through the email. Option 1 is to ask AFAIK to remove the image from their caches, this might just work. Option 2 is to resend the email, since you have already sent it, most users have propably already read it, so sending it again, with the corrected image is a good option.