473,785 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asp.Net Response filter / Content-Encoding header problem

Hello,

I'm trying to use a C# IHttpModule to install a Response filter
however IIS keeps removing the Content-Encoding header from the
response; but all the other headers I set stay intact.

So far I have tested my code on IIS 5.1, 6.0 and ASP.NET Development
Server/9.0.0.0 all with the same result.

Does anyone have any suggestions?

Source:

string encoding = m_HttpApplicati on.Request.Head ers["Accept-
Encoding"];

if (encoding != null)
{
if (encoding.Conta ins("gzip"))
{
m_HttpApplicati on.Response.Buf fer = true;
m_HttpApplicati on.Response.Fil ter = new
System.IO.Compr ession.GZipStre am(m_HttpApplic ation.Response. Filter,
System.IO.Compr ession.Compress ionMode.Compres s);

m_HttpApplicati on.Response.App endHeader("Cont ent-Encoding",
"gzip");
}
else if (encoding.Conta ins("deflate"))
{
m_HttpApplicati on.Response.Buf fer = true;
m_HttpApplicati on.Response.Fil ter = new
System.IO.Compr ession.DeflateS tream(m_HttpApp lication.Respon se.Filter,
System.IO.Compr ession.Compress ionMode.Compres s);

m_HttpApplicati on.Response.App endHeader("Cont ent-Encoding",
"deflate");
}
}

Request:
GET /en/us/ HTTP/1.1
Accept: */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
If-Modified-Since: Thu, 15 Nov 2007 02:35:39 GMT
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 1.0.3705; InfoPath.2; .NET
CLR 3.0.04506.590; .NET CLR 3.5.20706)
Host: localhost
Connection: Keep-Alive
Cookie: PNSite=2f594aef c5bb4a0b871eade 1a1a8ad03

Response:
HTTP/1.1 200 OK
Server: ASP.NET Development Server/9.0.0.0
Date: Mon, 19 Nov 2007 15:31:48 GMT
X-AspNet-Version: 2.0.50727
X-Powered-By: Parts Now! Site Server 10.0.2879
Set-Cookie: PNSite=2f594aef c5bb4a0b871eade 1a1a8ad03; expires=Thu, 22-
Nov-2007 15:31:48 GMT; path=/; HttpOnly
Cache-Control: public, max-age=86400
Expires: Tue, 20 Nov 2007 15:31:47 GMT
Last-Modified: Thu, 15 Nov 2007 02:35:39 GMT
Content-Type: text/html; charset=utf-8
Connection: Close
Nov 19 '07 #1
0 3322

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3898
by: jonezy | last post by:
i didnt think my sql qeury was that complicated that it would crash my web app. all im trying to do is filter data between two tables. heres my query <cfquery name="GetResults" datasource="#datasource#"> SELECT * FROM Content, Content_Sites WHERE Content.ContentID <> Content_Sites.ContentID ORDER BY Content.ContentID DESC </cfquery>
2
4180
by: David Union | last post by:
Hi. I'm posting this here because I don't know exactly what the best group is. This is for an aspx page with Visual Basic as the code-behind page. I am doing very simple code... in the middle of an http request, i set a filename (with path) and do a Response.WriteFile(filenamewithpath) then Response.End(). I have tried Response.Clear() and .Flush() ahead of time.
2
3116
by: Henrik Hofmann | last post by:
Hi, after a Request is finished I'd like to log the the byte quantity sent to the user to get a per user traffic analsis. The correct place to do this seems to me to be Applicaltion_EndRequest but how can I determine the length of the response. If I had an opportunit to just get the Content-length this would be fine too at first.
0
1163
by: Thomas Satzinger | last post by:
Hi to all. I am using the follwonmg code to download from an internal XmlDocument to the client file system: XmlDocument _doc ; // has some contents _doc.PreserveWhitespace = true; byte _bArr;
1
1820
by: Stacey | last post by:
I am receiving the response upon using webclient.upload method which contains the "order number" and related information strings followed by standard stuff under <HTML> <HEAD> elements. I would like to filter out this standard <HTML> element content and just want to save "order number" and related information to my response file. How do I do that?
1
1516
by: ocbka1 | last post by:
i'm using creating a webpage on the fly that i save as an xls file to be attached to an email and sent dynamically. i've got a custom response filter class to write it out. the problems start happening when i redirect - i need to somehow end the response but not with Response.End because it doesn't allow it to get to the Redirect statement and if i use something like Response.Close or Response.Clear it outputs "Object moved to here" text...
12
9572
by: Andrew C | last post by:
Hi, folks. I've recently been doing a few simple tests and experiments. As a result, I've noticed that, in dealing with 'onclick', IE seems less able than Firefox to keep up with rapid clicking. In fact, Firefox seems to be able to keep up with me no matter how rapidly I click, whereas IE... well, doesn't! The following snippet of code demonstrates this (on my machine it does anyway):
0
2880
by: mpdoreilly | last post by:
Hi, I've a webservice that has several typical webmethods that clients call and get responses from. (Side note: The websriivce is actually to implement the server side of tr-069, the protocol is somewhat funny in that the server can send arbitrary requests to the client in the RESPONSES to calls to its webmethods)
1
1190
by: Josh Naro | last post by:
I am writing a module that requires the entire output from a web app to perform its function. So, basically I need to be able to pull the entire output stream from the Response object. I've tried attaching a custom filter to Response.Filter, but the custom filter receives the stream in separate chunks. I need the entire stream at once in order to convert it to an XmlDocument. Does anyone know of a way to get the entire output stream from a...
0
971
by: Joseph Geretz | last post by:
At what point in the application lifecycle should a filter be applied to the Request / Response objects? Should this be done at the start of each transaction? This would make sense if a new Request / Response object is created fresh for each transaction. If these objects are reused though across transactions, then this is obviously not the approrpriate point to set these filters. I'm suspecting that my earlier issues with Response...
0
9485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9958
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.