[SOLVED] ASP.NET variable type for storing images C#


I have a ASP.Net project and I created a class where one of its properties will store images but I’m not quite sure what type of data type would be most efficient to do so.

Would Byte be the best possible solution?

Thanks in advance.


It is not feasible to store images in memory. The Page Lifecycle dictates that a page be build, any postback processed, send to the user and dropped from memory ASAP.

If it is only abunch of images for the branding, they can just be exposodes via the content directory and http access. Maybe even inlining it into the HTML. The same ways we did it since Web 1.0.

Anything beyond that will require you providing a Database to store the images. And way to deliver them to the enduser matching it. Usually you combine the Filestream/Blob in tabel approach with a HTTP handler for images: https://www.red-gate.com/simple-talk/sql/learn-sql-server/an-introduction-to-sql-server-filestream/

Answered By – Christopher

Answer Checked By – Gilberto Lyons (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *