Click here to Skip to main content
15,891,976 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: ashx session state is empty in firefox ? Pin
AhsanS20-Aug-08 19:34
AhsanS20-Aug-08 19:34 
GeneralRe: ashx session state is empty in firefox ? Pin
Christian Graus20-Aug-08 21:18
protectorChristian Graus20-Aug-08 21:18 
QuestionHow to programatically manipulate forms authentication settings of web.config file Pin
tjkota20-Aug-08 16:16
tjkota20-Aug-08 16:16 
AnswerRe: How to programatically manipulate forms authentication settings of web.config file Pin
Abhijit Jana20-Aug-08 18:26
professionalAbhijit Jana20-Aug-08 18:26 
GeneralRe: How to programatically manipulate forms authentication settings of web.config file Pin
tjkota22-Aug-08 9:11
tjkota22-Aug-08 9:11 
QuestionPost Message [modified] Pin
JoJuPi0120-Aug-08 10:14
JoJuPi0120-Aug-08 10:14 
AnswerRe: Post Message Pin
Blue_Boy20-Aug-08 14:15
Blue_Boy20-Aug-08 14:15 
Questioncompress Pin
aref8720-Aug-08 9:53
aref8720-Aug-08 9:53 
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
<httpmodules>
<add name="HttpCompression">
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;



[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Diagnostics.DebuggerStepThroughAttribute(), System.ComponentModel.DesignerCategoryAttribute("code"), System.Web.Services.WebServiceBindingAttribute(Name = "Service1Soap", Namespace = "http://tempuri.org/")]
public class Service : System.Web.Services.WebService
{
public Service () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/getproducts", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

public string HelloWorldAfterCompress() {
return "Hello World";
}
[WebMethod]
public string HelloWorldbeforeCompress()
{
return "Hello World";

}

}
AnswerRe: compress Pin
Christian Graus20-Aug-08 15:10
protectorChristian Graus20-Aug-08 15:10 
GeneralRe: compress Pin
aref8720-Aug-08 15:26
aref8720-Aug-08 15:26 
GeneralRe: compress Pin
Christian Graus20-Aug-08 15:50
protectorChristian Graus20-Aug-08 15:50 
GeneralRe: compress Pin
aref8720-Aug-08 19:48
aref8720-Aug-08 19:48 
GeneralRe: compress Pin
aref8721-Aug-08 22:01
aref8721-Aug-08 22:01 
GeneralRe: compress Pin
aref8722-Aug-08 3:12
aref8722-Aug-08 3:12 
QuestionData to temporary XLS with Multiple Worksheets and then emailed. Pin
gamerdrew20-Aug-08 9:16
gamerdrew20-Aug-08 9:16 
AnswerRe: Data to temporary XLS with Multiple Worksheets and then emailed. Pin
gamerdrew20-Aug-08 10:44
gamerdrew20-Aug-08 10:44 
AnswerRe: Data to temporary XLS with Multiple Worksheets and then emailed. Pin
Jörgen Andersson20-Aug-08 11:02
professionalJörgen Andersson20-Aug-08 11:02 
QuestionFCK editor Pin
shadow1720-Aug-08 6:19
shadow1720-Aug-08 6:19 
AnswerRe: FCK editor Pin
led mike20-Aug-08 9:40
led mike20-Aug-08 9:40 
QuestionJapanese currency symbol is displaying a single strikethrough on “Y” (i.e. “¥”) instead of double strikethrough (i.e. “¥”). Pin
mdpavel20-Aug-08 4:29
mdpavel20-Aug-08 4:29 
AnswerRe: Japanese currency symbol is displaying a single strikethrough on “Y” (i.e. “¥”) instead of double strikethrough (i.e. “¥”). Pin
Manas Bhardwaj20-Aug-08 5:19
professionalManas Bhardwaj20-Aug-08 5:19 
AnswerRe: Japanese currency symbol is displaying a single strikethrough on “Y” (i.e. “¥”) instead of double strikethrough (i.e. “¥”). Pin
Jörgen Andersson20-Aug-08 5:55
professionalJörgen Andersson20-Aug-08 5:55 
QuestionConvert XML file to an ASPX page Pin
Krishnaraj Barvathaya B20-Aug-08 3:08
Krishnaraj Barvathaya B20-Aug-08 3:08 
AnswerRe: Convert XML file to an ASPX page Pin
Abhijit Jana20-Aug-08 4:14
professionalAbhijit Jana20-Aug-08 4:14 
AnswerRe: Convert XML file to an ASPX page Pin
Manas Bhardwaj20-Aug-08 4:27
professionalManas Bhardwaj20-Aug-08 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.