clearing the cache also image is not refreshed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gopim
    New Member
    • Nov 2007
    • 30

    clearing the cache also image is not refreshed

    hi,
    i have a problem.
    i am saving bitmaptextimage dynamically in data/image1.jpg every time when i redirect to the image.aspx page and i am assignning this image url to the image control.but image is not refreshing.if we press F5 or REFRESH button then image is refreshing.
    i have used following techniques

    Code:
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.Now-new TimeSpan(1,0,0));
    Response.Cache.SetLastModified(DateTime.Now);		
    Response.Cache.SetAllowResponseInBrowserHistory(false);
    
    <%@ OutputCache Duration="1" VaryByParam="None" %>
    
    <meta http-equiv="refresh" 
    content="[n];url=http://www.microsoft.com/pagename.htm">
    reply me please
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    OutputCache location="none" . HTH.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      I've had good luck with
      Code:
      Response.Cache.SetNoStore();
      But you would need a way to set that header for the image request too.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        I know this problem!
        I had it a few months back.
        I had to dynamically retrieve an image from a database and show it to the user based on their account...I allowed them to update this image and I was stuck with the old one displaying..... ..

        Here's what happened:
        I gave the image a name when I grabbed the image from the database and stored it temporarily in the folder where the web server could retrieve it...so it could be displayed in the web browser.

        Every time this happens, the image is named the same thing (based on the user's login properties).

        The browser grabbed that image and cached the image.
        When the browser came back to the page, the old image would always appear because the browser didn't download the new image.

        So to get around this problem I appended random numbers to the image name...forcing the browser to download the new image.


        The meta tag that indicates "no-cache" did not help resolve this issue because this tag is used by ASP.NET, not your web browser.

        It allows the ASP.NET technology to determine whether or not a cached version of the compiled ASP code should be used...

        Setting this meta tag to "no-cache" indicates to the ASP.NET technology that the ASP code should be compiled every web-request.

        I could be wrong about this...but I'm almost 100% sure.

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5
          Instead of writing a lot of temporary files, you could also create a serve-up page that responds back with "content-type: jpeg" and the jpeg data.
          I use that for certain situations, helps control security a little better.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Originally posted by Plater
            Instead of writing a lot of temporary files, you could also create a serve-up page that responds back with "content-type: jpeg" and the jpeg data.
            I use that for certain situations, helps control security a little better.
            Or you could overwrite the old jpegs with new :D

            Comment

            • Plater
              Recognized Expert Expert
              • Apr 2007
              • 7872

              #7
              Originally posted by Frinavale
              Or you could overwrite the old jpegs with new :D
              My file system does not allow write access to the webservice for any of it's directories contained withen itself. So writing a bunch of temporary files that are available to the outside world through http is not permsible.
              Just an alternative :-P

              Comment

              Working...