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

  • Home
  • SEARCH
  • 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 4044032
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:12:10+00:00 2026-05-20T13:12:10+00:00

We have an ASP.NET/C# 2.0 (.NET 2.0) web application. To make the client to

  • 0

We have an ASP.NET/C# 2.0 (.NET 2.0) web application.

To make the client to download a byte array programmatically we have a piece of code which looks like this:

Response.ContentType = contentType ?? "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);    

Stream iStream = ...
byte[] buffer = new Byte[10000];

while (dataToRead > 0)
{
  // Verify that the client is connected.
  if (response.IsClientConnected)
  {
    // Read the data in buffer.
    length = iStream.Read(buffer, 0, 10000);

    // Write the data to the current output stream.
    response.OutputStream.Write(buffer, 0, length);

    // Flush the data to the HTML output.
    response.Flush();

    //buffer= new Byte[10000];
    dataToRead = dataToRead - length;
  }
  else
  {
    //prevent infinite loop if user disconnects
    dataToRead = -1;
  }
}

Response.Flush();
Response.Close();

This works on all our installations but one (on IIS 6) where I got files truncated (about 30KB). Did you ever experience such a problem?

  • 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-20T13:12:10+00:00Added an answer on May 20, 2026 at 1:12 pm

    The problem was related to a module. We solved with Response.End() to prevent the execution of the module.

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

Sidebar

Related Questions

I have a asp.net web application which has a number of versions deployed on
I have an ASP.NET web application which does the following: Reads an Excel file.
We have an intranet asp.net web application which uses the OOTB ASP.net membership and
I have an ASP.NET web application I built for a client that uses default
I have a ASP.NET Web application which has 2 projects (one for UI and
I have an asp.net web application which I want have multilingual support now. For
Suppose you have two seperate ASP.NET Web Application projects that both need to use
We have a ASP.Net 2.0 web application up and running with the server in
I have a really simple ASP.NET web application and a web setup project that
I have a scenario where users of my ASP.NET web application submit testimonials consisting

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.