locked
Image won't reload in Firefox RRS feed

  • Question

  • User798234430 posted

    Hi everyone!

    My web-application redraws an image after user clicks some button. Image is being passed using handler (.ashx), and asp:Image element is within an UpdatePanel. It woks perfect in IE, but Firefox somehow doesn't reload it until some one pressed Reload button in the browser.

    Can anyone please help me?

    Here's the code of the handler:

    <%@ WebHandler Language="C#" Class="ChartHandler" %>
    
    using System;
    using System.Web;
    
    public class ChartHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
    {
        
        public void ProcessRequest (HttpContext context)
        {
            context.Response.ContentType = "image/png";
            context.Response.Cache.SetNoStore();
            context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            context.Response.Cache.SetExpires(DateTime.Now);
            context.Response.Cache.SetValidUntilExpires(false);
    
            System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)context.Session["Graph"];
            
            using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
            {
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                ms.Flush();
                context.Response.BinaryWrite(ms.GetBuffer());
            }
        }
     
        public bool IsReusable {
            get {
                return false;
            }
        }
    
    }
     
    Wednesday, November 15, 2006 4:03 AM

Answers

  • User798234430 posted

    Thanx for help! I've solved the problem by adding to the image url a parameter with random value on PageLoad. This makes browser reload the image, since its source has been changed.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 15, 2007 4:06 AM

All replies

  • User1985512381 posted

    Hi,

    You replace <asp:image> by <input type="Image" id="img" runat="server">, Is that OK!

    Good luck 

    BUI Van Hoc 

    Tuesday, January 9, 2007 1:31 AM
  • User798234430 posted

    Thanx for help! I've solved the problem by adding to the image url a parameter with random value on PageLoad. This makes browser reload the image, since its source has been changed.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 15, 2007 4:06 AM