Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7909385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:23:25+00:00 2026-06-03T12:23:25+00:00

I am storing images in a database and I am using an image handler

  • 0

I am storing images in a database and I am using an image handler to display the images using the file path + id. The problem I have is when I update the image through the page, the image doesn’t change. Wierd thing is I don’t have this problem with firefox or chrome.

ASHX handler

public void ProcessRequest(HttpContext context)
    {
        Guid image_id;
        if (context.Request.QueryString["id"] != null)
            image_id = System.Guid.Parse(context.Request.QueryString["id"]);
        else
            throw new ArgumentException("No parameter specified");

        context.Response.ContentType = "image/jpeg";
        Stream strm = GetImageFromDatabase(image_id);
        if (strm != null)
        {
            byte[] buffer = new byte[4096];
            int byteSeq = strm.Read(buffer, 0, 4096);

            while (byteSeq > 0)
            {
                context.Response.OutputStream.Write(buffer, 0, byteSeq);
                byteSeq = strm.Read(buffer, 0, 4096);
            }
            //context.Response.BinaryWrite(buffer);
        }
    }

User control code

string imagePath = "<a href=" + (Image.ImageUrl = "~/ShowImage.ashx?id=" + r["Image_id"]);

Markup

<asp:UpdatePanel ID="Upd1" runat="server" UpdateMode="Always" >
    <ContentTemplate>
        <div id="mpe" style="width: 600px; padding: 5px;">
            <uc2:IMG ID="IMG1" cssclass="bodycopy" runat="server" />
        </div>
        <asp:UpdateProgress ID="upp1" runat="server" AssociatedUpdatePanelID="Upd1">
            <ProgressTemplate>
                <div id="progressBackgroundFilter">
                </div>
                <div id="modalPopup">
                    &nbsp; &nbsp; Loading...
                    <img align="middle" src="../images/Ajax/loading_1.gif" />
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </ContentTemplate>
</asp:UpdatePanel>

I am not sure what other code to post but here is what I think is relevant. When I click my button to update an image it successfully updates the row in the database. Also I can update data about an image and this correctly updates.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:23:27+00:00Added an answer on June 3, 2026 at 12:23 pm

    What I ended up doing is using a guid as my image id in my Image handler. But in my SQL, when I update an image I use sql servers in-built newid() function so everytime an update is made that images guid will change. By doing this IE recognises that its not the same ID and doesn’t use the cached image.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an SQLite Database in which I am storing images as BLOB using
i'm trying to display an image from the database in an ASP.NET web page.
I have an image upload handler (.ASHX). I am storing image meta data in
Instead of storing images using BLOB in mySQL, I have decided to attempt to
I have a requeriment to store images in the database using django, and for
I have a string in my database that represents an image. It looks like
I just switched from storing my images uploaded via Carrierwave locally to using Amazon
The best way to store images into MySQL is by storing the image location
First of all, this isn't another question about storing images on DB vs file
Possible Duplicate: Storing Images in DB - Yea or Nay? Images in database vs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.