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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:37:01+00:00 2026-05-25T15:37:01+00:00

in my asp .net application i’m using an entity derived from a data base

  • 0

in my asp .net application
i’m using an entity derived from a data base (a “Product” Entity) .
the Entity among-st various fields requires 3 image fields .

i load thous image files using a FileUpload , i would like to add the entity to the context(Entity Framework) after iv’e added the 3 images to it .

  context.AddToProduct(Product);    

i was wondering what would be the best practice of saving these files before submition

i.e.

i got 3 byte[] arrays that need to be saved for a particular product being uploaded to the site .

i thought of just creating a directory on the server side with the products name ,
and later when all the product’s credentials are submitted ill pack them together with the images into a product entity and save it in the entity model.

i am looking for a more asp .net kinda way to cache them and retrieve them when needed .

any ideas.

here is an example for a single image loaded for the product

           byte[] imageSize = new byte[FileUpload1.PostedFile.ContentLength];
           HttpPostedFile uploadedImage = FileUpload1.PostedFile;
           uploadedImage.InputStream.Read(imageSize,0,(int)FileUpload1.PostedFile.ContentLength);
           MyProduct product = new MyProduct()
           {
               Image = imageSize,
               Date = DateTime.Now,
               State = 1,
               Short = "short discription",
               Long = "long.......................",
               Title = "Some Title",
               Price = (float)11.1,
               OwnerID = int.Parse(Response.Cookies["user"]["id"]),                        
           };    

further more,
if i save for Session[“file1”] Session[“file2”] Session[“file3”] but this could cause performance issues if allot of users attempt to load pictures for there files.

  • 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-25T15:37:01+00:00Added an answer on May 25, 2026 at 3:37 pm

    If you save in session, only the user who triggered the picture saving will have access to it. All other users will have their Session[“file1”] with a different (or null) value as the session is different.

    The way I use to do it is to save the images into the database. I like this approach ’cause this way there are no “external dependencies”, i.e., paths that may be broken.

    Saving the image into session will only allow you to cache it for one user. Saving it into a server variable, will allow anyone to retrieve it (just be careful for not to overload the RAM with the images)

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

Sidebar

Related Questions

My ASP.NET application loads an assembly and creates a class instance from an object
My asp.net application is not using formsauthentication. Instead we make a call to database,
My ASP.NET application utilises a Modules system by using Type.GetType() on a fully-qualified string
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
For ASP.Net application deployment what type of information (if any) are you storing in
The ASP.NET application that I am currently responsible for at my day job has
My ASP.NET application allows users to upload and download large files. Both procedures involve
My ASP.NET application needs a number of supporting services to run periodically in the
I have an Asp.NET application (VS2008, Framework 2.0). When I try to set a
I have a ASP.NET application that we've written our own logging module for. My

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.