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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:07:39+00:00 2026-05-27T20:07:39+00:00

I have to generate some files in my asp.net web application and send it

  • 0

I have to generate some files in my asp.net web application and send it to the client.
So I made a method who work with a memory stream and send the buffer to the http response.

It is working fine but I just read another code and the guy is using a fileInfo. So if I understand correctly FileInfo is a “real” file written on the server disk.

So what is the best choice? (if there’s one) What are questions I have to ask me? Is it about the size of the file?

Note that I don’t care about storing the file, once he is send I don’t have to have it on the server.

  • 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-27T20:07:40+00:00Added an answer on May 27, 2026 at 8:07 pm

    FileInfo is only a pointer to a file already stored on a file system. If you want to access its contents you need to use a stream. So in your case if you don’t want to save the file on the server you could use a MemoryStream and write it to the response. A Stream is also a pointer to some data. A MemoryStream is a pointer to a data stored in memory. So you will need to first load this data in memory.

    A better way is to directly write to the Response object in chunks. This way you don’t need to load the whole file contents in memory. But this will depend on how you are generating the file.

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

Sidebar

Related Questions

I have a .NET console application that needs to generate some HTML files. I
I have an asp.net website that will generate some excel files with 7-8 sheets
I have a web application built in asp.net, which uses resource files to support
I'm developing a web application with asp.net and I have a file called Template.docx
I have a C# Windows Service and an ASP.NET 4.0 web application that are,
I have an ASP.NET web application that calls a .NET DLL, that in turn
I have an ASP.Net/MVC application and I'm trying to send HTML emails. I'm doing
I have a working ASP.NET MVC web application to manage projects and customers. Now
I have an ASP.NET application that relies on the Random class to generate a
I have some php files in a server which generate xml code in them.

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.