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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:26:52+00:00 2026-05-12T05:26:52+00:00

When you receive an uploaded file in ASP.NET, you generally do so via an

  • 0

When you receive an uploaded file in ASP.NET, you generally do so via an HttpPostedFile object. The received data is made available via HttpPostedFile.InputStream. This is a property, which would lead me to believe I don’t need to dispose it myself, however the documentation never mentions who is responsible for disposing the stream, and if it’s done by the ASP.NET framework, when it does so (say, can I save the stream in the session, should I wish to?).

Now, I don’t receive that many files, and I’ve not run into problems for not disposing this particular stream, but for cleanliness – does anyone know what the design contract here is?

  • 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-12T05:26:52+00:00Added an answer on May 12, 2026 at 5:26 am

    From my experience working with it I would say that it is released as soon as the request processing is complete. An example is if I were to throw a ball into the air. If I don’t catch it and it hits the ground…it is disposed of. If I catch it and do something with it…and then drop it is disposed of. It doesn’t hang around for you to play with in the next request!

    Addressing the issue of storing it in the session I would say NOOOOOO! If you need it to be around for a while write it to the file system. When you need it again reconstitute it as a stream and play with it. Storing a file stream in the session (as a byte array perhaps?) sounds like a huge waste of your session (memory) resources.

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

Sidebar

Related Questions

I receive Date and time from CSV file The received Date format is YYYYMMDD
I receive the following error when trying to run my ASP.NET MVC application: The
How do I receive an uploaded file from WGET in PHP? wget --post-file=file.txt --header=Content-type:
I have a Form that I am using to receive an uploaded .csv file,
I am having a InputStream Object which is actually a zip file. I want
We receive lots of data as flat files: delimitted or just fixed length records.
I receive TypeError: Can't convert 'float' object to str implicitly while using Gambler.pot +=
I receive a daily XML file that contains thousands of records, each being a
I tried to email a DLL-file built with Delphi but received an rejection email
So - I've been using this method of file uploading for a bit, but

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.