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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:14:36+00:00 2026-05-11T03:14:36+00:00

I want to provide dynamic download of files. These files can be generated on-the-fly

  • 0

I want to provide dynamic download of files. These files can be generated on-the-fly on serverside so they are represented as byte[] and do not exist on disk. I want the user to fill in an ASP.NET form, hit the download button and return the file he/she wanted.

Here is how my code behind the ASP.NET form looks like:

public partial class DownloadService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {  }  protected void submitButtonClick(object sender, EventArgs e) {     if (EverythingIsOK())     {         byte[] binary = GenerateZipFile();          Response.Clear();         Response.ContentType = 'application/zip';         Response.ContentEncoding = System.Text.Encoding.UTF8;         Response.BinaryWrite(binary);         Response.End();     } } ... } 

I expected this piece of code just work. I clear the Respone, put in my generated zip file and bingo. However, this is not the case. I get the following message in the browser:

The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. An invalid character was found in text content. Error processing resource ‘http://localhost:15900/mywebsite/DownloadS…

What am I doing wrong?

  • 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. 2026-05-11T03:14:36+00:00Added an answer on May 11, 2026 at 3:14 am

    Here’s a minor modification you need to make:

    Response.Clear(); Response.ContentType = 'application/x-zip-compressed'; Response.BinaryWrite(binary); Response.End(); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Source control and automated tests are two things that will… May 11, 2026 at 11:31 am
  • added an answer You may be interested in jsyntaxpane. It uses a PlainDocument… May 11, 2026 at 11:31 am
  • added an answer You can create multiple app domains in a single program/process.… May 11, 2026 at 11:31 am

Related Questions

I want to provide dynamic download of files. These files can be generated on-the-fly
I want to provide silverlight app to my customer while hosting the app at
I want to provide a piece of Javascript code that will work on any
I want to use RSpec mocks to provide canned input to a block. Ruby:
If I want to provide OpenID as the only registration method available AND want
I want to create a right click context menu for my textboxes to provide
I want to have the context menu of links provide me an option to
I want to answer questions about data in Erlang: count things, correlate messages, provide
I'm working on a resource management class and want to have the user provide
I want to create an allocator which provides memory with the following attributes: cannot

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.