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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:49:33+00:00 2026-05-13T16:49:33+00:00

Let’s say that I have a website where I’d like users to be able

  • 0

Let’s say that I have a website where I’d like users to be able to download a certain group of files. There will be checkboxes and listboxes of options for users to choose from, so that they can select what parts they want to include and what they don’t want to download. Then, they click the Download button and their browser downloads a zip file containing only the things they selected.

I want to accomplish such a hypothetical situation with ASP.NET and C#. Of course, I could make zip files of all the permutations, but that would take a LOT of time. Is it somehow possible, if I have the file paths of files stored on my server, to take some of those files, zip them up (in memory or on disk and then delete it), and send the zip file to the client thru the Response?

UPDATE: I just found the following question and code sample thru the Related box:

private void sendToClient(Dictionary<string, string> reportDic)
{
    Response.Clear();
    Response.BufferOutput = false;
    String ReadmeText = "some text";
    Response.ContentType = "application/zip";
    Response.AddHeader("content-disposition", "filename=" + "filename.zip");
    using (ZipFile zip = new ZipFile())
    {
        zip.AddEntry("Readme.txt", ReadmeText);
        zip.Save(Response.OutputStream);
    }
    Response.Close();
}

It uses DotNetZip to zip up the file.

Do you think this is what I’m looking for? I’m going to go read the docs of DotNetZip.

  • 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-13T16:49:33+00:00Added an answer on May 13, 2026 at 4:49 pm

    Yes it is possible to build write a GZip stream to the response in memory like a normal stream. example at:

    http://www.vwd-cms.com/forum/forums.aspx?topic=18

    Although I don’t know why you would to delete it after? Zipping and IO access takes resources, a good way to save it is to cache it. I personally would use Enum flags and bit arithmetic to capture all the user options into a single integer and append it to the filename so you can return it again if someone asks for exactly the same configuration.

    Edit: added example

    [Flags] //doesn't mean anything just declarative
    public enum UserOptions
    {
        None = 0,
        Option1 = 1 << 0,  //1  or  0001
        Option2 = 1 << 1,  //2  or  0010
        Option3 = 1 << 2,  //4  or  0100
        Option4 = 1 << 3,  //8  or  1000
    }
    
    var userOptions = UserOptions.None;
    
    if (Request["UserWantsOption2"])
    {
      userOptions |= UserOptions.Option2;  //userOptions = 2
    }
    if (Request["UserWantsOption4"])
    {
      userOptions |= UserOptions.Option4;  //userOptions = 10 (2 + 8)
    }
    

    So as we’re just using bit flags together if you end up with a value of ’10’ then it means that the user has selected options 2 and 4 as there is no other combinations possible to add up to that value.

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

Sidebar

Related Questions

Let's say that I have a set of relations that looks like this: relations
Let's say you have a class, with certain properties, and that you tried your
Let's say I don't have photoshop, but I want to make pattern files (.pat)
Let me explain best with an example. Say you have node class that can
Let's say that I have a SQLite database that I create in a separate
Let's say I have thousands of users and I want to make the passwords
Let's say I have a sortable list like this: $(.song-list).sortable({ handle : '.pos_handle', axis
Let's say I have a string like this: var str = /abcd/efgh/ijkl/xxx-1/xxx-2; How do
Let's say I have a text file composed like this ##### typeofthread1 ##### typeofthread2
Let's say there is a graph and some set of functions like: create-node ::

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.