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 7576471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:55:44+00:00 2026-05-30T16:55:44+00:00

I’ve got a .NET MVC app where I need to display a list of

  • 0

I’ve got a .NET MVC app where I need to display a list of images with some text. The images and text are stored in the database in the same table, and returned in my simple model. What I haven’t figured out is how to display all of these images without hitting the database again for every single image.

I see several examples, such as:

  • ASP.NET MVC: loading images from database and displaying their in view
  • Problem with displaying image from DB using asp.net MVC 2

and others, but they all go back to the database for every image. That doesn’t make sense, because there could be dozens of images, and I don’t want to keep making single calls to the database when I already have the image data returned in my model.

I’m new to ASP.NET MVC, (and also never worked with images stored in a DB before) and I think I am just missing something, and that it can’t be this difficult. If anyone has solved this, I’d love to hear it, and I think others would too, based on the other questions already here.

  • 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-05-30T16:55:45+00:00Added an answer on May 30, 2026 at 4:55 pm

    Just hit the database multiple times. I once thought it was a clever idea to load the images together with the text in the cache and then invalidate the cache when they were served. I also had to generate random URLs to avoid different users invalidating each others cache. I thought it was so clever to reduce the number of DB queries.

    I am now so ashamed by this “cleverness” and I don’t tell anybody. Don’t think about it unless you have actual performance problem.

    It is important to implement client side caching by setting the appropriate headers. Images are better cached on the client than on the server because even if you cache on the server you still take the network transfer hit if you do not cache on the client.

    Also hitting the database by primary key (I assume this is how you are going to retreive images) is not an expensive operation and unless the images are 2MB+ I wouldn’t worry about transfer from the database to the web server either.

    Edit: And I just told everybody about my shame 🙁

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
In my XML file chapters tag has more chapter tag.i need to display chapters
I have a reasonable size flat file database of text documents mostly saved in
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.