compress
-
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
-
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
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.
-
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.
-
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.
-
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.
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.
-
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.
-
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.