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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:31:36+00:00 2026-05-26T22:31:36+00:00

I had a weird problem about GZip and I hope you can help me.

  • 0

I had a weird problem about GZip and I hope you can help me.

using (MemoryStream memoryStream = new MemoryStream(10240))
{
   //isCompressed will be true if the browser accepts gzip
   using (Stream writer = isCompressed ?
                    (Stream)(new GZipStream(memoryStream, CompressionMode.Compress)) :
                    memoryStream)
   {
      StringBuilder sb = new StringBuilder();

      //filenames is collection of multi js files need to be minify
      foreach (string fileName in fileNames)
      {
         sb.Append(File.ReadAllText(context.Server.MapPath(fileName)));
      }

      //minifier is an instance of Microsoft.Ajax.Utilities.Minifier
      string minifiedString = minifier.MinifyJavaScript(sb.ToString());

      byte[] bts = Encoding.UTF8.GetBytes(minifiedString);
      writer.Write(bts, 0, bts.Length);
   }
}

The length of bts is actually over 6000, however, when writer.Write(bts, 0, bts.length) has been executed, writer can only write 2334 characters, I checked the inside info, it says, operation is not support, I was so confused, and I don’t know why?

  • 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-26T22:31:36+00:00Added an answer on May 26, 2026 at 10:31 pm

    If I understand the scenario, Vinay is correct that the 6k is being compressed. However, why use custom code to gzip your content? Why not just turn on static and dynamic compression in IIS and let IIS do the work? Furthermore, use a library like http://RequestReduce.com that will automatically combine and minify your css and js on the fly with no code and possibly no config as well as sprite your images.

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

Sidebar

Related Questions

I had a weird problem, our website has registration form coded using zend form,
I am having a very weird problem that I've never had before when using
I had a weird idea about a hashing function. The problem statement is You
I had a weird problem, where I opened up a source code project for
I've a very weird problem: after upgrading from Ubuntu 10.10. to 11.04 (new installation),
I had a very weird problem with precompile header. The linker generates LNK2019: unresolved
I've started using SVN before a few weeks. I am facing a weird problem
I had this weird experience with problem number 10 on Project Euler (great site
Had an interesting discussion with some colleagues about the best scheduling strategies for realtime
Had a good search here but can't see anything that gets my mind in

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.