473,503 Members | 3,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Filter problem in Application_PreSendRequestContent

Hi,

I'm trying to compress all requests.
When client send a request, I will compress the response and send it to
client.
For this purpose I get Response.Filter stream and try to read this
stream.(Because I need a string of response)
Here is my code:
protected void Application_PreSendRequestContent(object sender, EventArgs e)

{

Stream sTemp = Response.Filter;

sTemp = new TrimStream(sTemp);
StreamReader sr = new StreamReader(sTemp);

string strHTML = sr.ReadToEnd();

sr.Close();

}

I get an error on the 4th line(string strHTML = sr.ReadToEnd();
Here is my TempStream class.

public class TempStream : Stream

{

private Stream stream;

public TempStream(Stream stm)

{

stream = stm;

}

public override void Write(byte[] buffer, int offset, int count)

{
}

public override int Read(byte[] buffer, int offset, int count)

{

return stream.Read(buffer, offset, count);

}

public override bool CanRead

{

get { return true; }

}

public override bool CanSeek

{ get { return true; } }

public override bool CanWrite

{ get { return true; } }

public override long Length

{ get { throw new NotSupportedException(); } }

public override long Position

{

get { throw new NotSupportedException(); }

set { throw new NotSupportedException(); }

}

public override void Flush()

{

stream.Flush();

}

public override long Seek(long offset, SeekOrigin origin)

{

throw new NotSupportedException();

}

public override void SetLength(long value)

{

throw new NotSupportedException();

}

}

Any help will be appreciated kindly.
Thanks
Apr 24 '06 #1
0 1566

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

Similar topics

1
2448
by: Lou | last post by:
I'm using the Response Filter Class in MS KB article 811162 (http://support.microsoft.com/default.aspx?scid=kb;EN-US;811162) to generate a static htm page from an asp.net template page being...
5
2732
by: Paul de Goede | last post by:
I set the Response.Filter in my aspnet application but I have noticed that if you do a Server.Transfer that the filter doesn't get called. And in actual fact the response is mostly empty. It seems...
3
2434
by: Brad | last post by:
I have a response filter which injects "standard" html into my pages. The filter works fine when the initial stream is small enough not to buffer...or....if I have a large unbuffered stream (i.e. I...
7
4115
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge...
0
1141
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...
1
1502
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...
1
1177
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...
0
3295
by: elliott | last post by:
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. ...
0
964
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...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7261
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,...
0
7315
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...
0
7445
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...
1
4991
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...
0
3158
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...
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.