Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. compress

compress

Scheduled Pinned Locked Moved ASP.NET
csharpdesignsysadminsecurityquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aref87
    wrote on last edited by
    #1

    Hello I use from a compress C# code in HttpCompression.cs and i use from two methods in sercice.cs one for before compress other for after compress DO I do it true? also i added HttpCompression.dll to web.config type="Behrouz.Compression.HttpCompression, HttpCompression"/> C# code for compress: its file is HttpCompression.cs using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.Services.Protocols; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using Microsoft.VisualBasic; using System.IO; using System.IO.Compression; using Microsoft.CSharp; /// <summary> /// Summary description for HttpCompression /// </summary> namespace Behrouz.Compression { public class HttpCompression : IHttpModule { //public HttpCompression() // { // // TODO: Add constructor logic here // // } void IHttpModule.Dispose() { } void IHttpModule.Init(System.Web.HttpApplication context) { context.BeginRequest += this.onZip; } public void onZip(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; string encodings = app.Request.Headers.Get("Accept-Encoding"); if (encodings == null) return; Stream baseStream = app.Response.Filter; encodings = encodings.ToLower(); if ((encodings.Contains("gzip"))) { app.Response.Filter = new GZipStream(baseStream, CompressionMode.Compress); app.Response.AddHeader("Content-Encoding", "gzip"); } else if (encodings.Contains("deflate")) { app.Response.Filter = new DeflateStream(baseStream, CompressionMode.Compress); app.Response.AddHeader("Content-Encoding", "deflate"); } } } } C# code in server side: its file is service.cs sing System; using System.Web; using System.Web.Services; using System.Data; using System.IO.Compression; using System.Data.SqlClient; using System.Web.Services.Protocols; using Behrouz.Compression; [We

    C 1 Reply Last reply
    0
    • A aref87

      Hello I use from a compress C# code in HttpCompression.cs and i use from two methods in sercice.cs one for before compress other for after compress DO I do it true? also i added HttpCompression.dll to web.config type="Behrouz.Compression.HttpCompression, HttpCompression"/> C# code for compress: its file is HttpCompression.cs using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.Services.Protocols; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using Microsoft.VisualBasic; using System.IO; using System.IO.Compression; using Microsoft.CSharp; /// <summary> /// Summary description for HttpCompression /// </summary> namespace Behrouz.Compression { public class HttpCompression : IHttpModule { //public HttpCompression() // { // // TODO: Add constructor logic here // // } void IHttpModule.Dispose() { } void IHttpModule.Init(System.Web.HttpApplication context) { context.BeginRequest += this.onZip; } public void onZip(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; string encodings = app.Request.Headers.Get("Accept-Encoding"); if (encodings == null) return; Stream baseStream = app.Response.Filter; encodings = encodings.ToLower(); if ((encodings.Contains("gzip"))) { app.Response.Filter = new GZipStream(baseStream, CompressionMode.Compress); app.Response.AddHeader("Content-Encoding", "gzip"); } else if (encodings.Contains("deflate")) { app.Response.Filter = new DeflateStream(baseStream, CompressionMode.Compress); app.Response.AddHeader("Content-Encoding", "deflate"); } } } } C# code in server side: its file is service.cs sing System; using System.Web; using System.Web.Services; using System.Data; using System.IO.Compression; using System.Data.SqlClient; using System.Web.Services.Protocols; using Behrouz.Compression; [We

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      aref87 wrote:

      DO I do it true?

      I don't know, does it seem to work ?

      Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

      A 1 Reply Last reply
      0
      • C Christian Graus

        aref87 wrote:

        DO I do it true?

        I don't know, does it seem to work ?

        Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

        A Offline
        A Offline
        aref87
        wrote on last edited by
        #3

        hello i do not underestant your question what is your SCOPE?

        C 1 Reply Last reply
        0
        • A aref87

          hello i do not underestant your question what is your SCOPE?

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Gosh - are you serious ? You posted a bunch of code and said 'is this right'. No-one is going to trawl through your code with such a vague question. Why do you ask ? Is it working as expected ? What is your specific concern ?

          Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

          A 1 Reply Last reply
          0
          • C Christian Graus

            Gosh - are you serious ? You posted a bunch of code and said 'is this right'. No-one is going to trawl through your code with such a vague question. Why do you ask ? Is it working as expected ? What is your specific concern ?

            Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

            A Offline
            A Offline
            aref87
            wrote on last edited by
            #5

            Hello I want to use compressing of message for my weservice. I want a dataset that it is full of orders table of Northwind,then i want send it to client compressin. I tried with 2 ways the first way is in this address:[it is vb.net and i converted to C#] http://www.dotnetjunkies.com/PrintContent.aspx?type=tutorial&id=46630AE2-1C79-4D5F-827E-6C2857FF1D23 the second way is in this address: http://www.barnamenevis.org/forum/showthread.php?t=55129&page=1 that the second address is codes that you saw in my post in codeproject. i tried very much for getting a true answer about compressing,but non of the above could guid me to a true result. it seems that i have lost true way for getting a good result , and i want anyone help me.

            A 1 Reply Last reply
            0
            • A aref87

              Hello I want to use compressing of message for my weservice. I want a dataset that it is full of orders table of Northwind,then i want send it to client compressin. I tried with 2 ways the first way is in this address:[it is vb.net and i converted to C#] http://www.dotnetjunkies.com/PrintContent.aspx?type=tutorial&id=46630AE2-1C79-4D5F-827E-6C2857FF1D23 the second way is in this address: http://www.barnamenevis.org/forum/showthread.php?t=55129&page=1 that the second address is codes that you saw in my post in codeproject. i tried very much for getting a true answer about compressing,but non of the above could guid me to a true result. it seems that i have lost true way for getting a good result , and i want anyone help me.

              A Offline
              A Offline
              aref87
              wrote on last edited by
              #6

              Hello Is there one who help me? with thanks

              A 1 Reply Last reply
              0
              • A aref87

                Hello Is there one who help me? with thanks

                A Offline
                A Offline
                aref87
                wrote on last edited by
                #7

                Hello when i use from using ICSharpCode.SharpZipLib or using ICSharpCode.SharpZipLib.zip and then when i want to produce dll file ,i go to following path: D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and i produce dll file from this code: csc /t:library /r:System.dll,System.Web.dll D:\inetpub\wwwroot\myApp\App_Code\HttpCompression.cs but i get this error: there is not ICSharpCode.SharpZipLib.zip But i add ICSharpCode.SharpZipLib.dll to my project and put it to bin folder.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups