473,625 Members | 2,853 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Filter problem in Application_Pre SendRequestCont ent

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_Pre SendRequestCont ent(object sender, EventArgs e)

{

Stream sTemp = Response.Filter ;

sTemp = new TrimStream(sTem p);
StreamReader sr = new StreamReader(sT emp);

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(Stre am 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(buf fer, 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 NotSupportedExc eption(); } }

public override long Position

{

get { throw new NotSupportedExc eption(); }

set { throw new NotSupportedExc eption(); }

}

public override void Flush()

{

stream.Flush();

}

public override long Seek(long offset, SeekOrigin origin)

{

throw new NotSupportedExc eption();

}

public override void SetLength(long value)

{

throw new NotSupportedExc eption();

}

}

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

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

Similar topics

1
2464
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 filled from a database. The generated static pages are then streamed into FreeTextbox editor for user edits. I want to use a variable for the filename since each user will need a separate temporary template page. The system works fine for a...
5
2740
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 that only scripts get rendered. I have seen this mentioned on this newsgroup before but with no resolution. Can anyone give any insight into this problem. Is there a work around? Manually push the Reponse.OutputStream through your filter after...
3
2453
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 set buffer=false on a large page). Now the problem: If I turn on buffering on a large page, the page output (to the browser) is correct a few times (sometines just once, sometime 2-3 times...on the same page) then I seem to either lose data...
7
4137
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 is how to corelate the response to a corresponding request. I am looking for a sure proof threadsafe way to corelate a response to a coresponding request message. Two things that concerns me:-
0
1154
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
1508
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...
1
1183
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
3306
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. 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?
0
966
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
8189
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
8635
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...
0
8497
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...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
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
5570
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
4192
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.