473,769 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting all of the output from HttpResponse in a module (Custom Filter?).

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 web app using a module?

Jun 20 '07 #1
2 1622
On Jun 20, 10:46 am, Josh Naro <joshn...@gmail .comwrote:
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 web app using a module?
Well, I managed to figure this one out myself.

Answer:
1. Create a custom filter that makes use of the singleton pattern.
2. Have the filter store each stream as it comes through in a public
variable (i.e. temp += currentStream).
3. Install the filter on BeginRequest of the application from within
a module.
4. Grab your filter on EndRequest of the application from within the
module.
5. Your singleton filter should now have the entire output of the
application in its temp variable.

Jun 20 '07 #2
On Jun 20, 11:31 am, Josh Naro <joshn...@gmail .comwrote:
On Jun 20, 10:46 am, Josh Naro <joshn...@gmail .comwrote:
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 web app using a module?

Well, I managed to figure this one out myself.

Answer:
1. Create a custom filter that makes use of the singleton pattern.
2. Have the filter store each stream as it comes through in a public
variable (i.e. temp += currentStream).
3. Install the filter on BeginRequest of the application from within
a module.
4. Grab your filter on EndRequest of the application from within the
module.
5. Your singleton filter should now have the entire output of the
application in its temp variable.
Don't forget to destroy the singleton after use (it'll hang around for
the next request).
Also, you must create a separate singleton for each context you're
working with so that multiple requests are not intermingled.

Jun 20 '07 #3

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

Similar topics

3
4907
by: Jorge Cecílio | last post by:
Hi! I would like to export some MS-Access reports output to pdf. However, the only possibility offered by Access (afaik) for me to export formatted output is snp (snapshot) (I use MS-Office XP Prof. 2002 version). With formatted output I mean the *exactly* output I produce from executing my report (information is gathered from an ODBC database).
0
1760
by: Cybermedia Marketing | last post by:
I'm trying to convert an ISAPI filter to an httpmodule. The ISAPI filter added custom headers to the response which could later be accessed by the asp page. ISAPI Filter: pvPrep->SetHeader(pfc, "Instance-Id:", info->instance_id); pvPrep->SetHeader(pfc, "Company-Id:", info->company_id); pvPrep->SetHeader(pfc, "Primary:", info->hostname); pvPrep->SetHeader(pfc, "Profile:", buffer);
5
1740
by: Brad | last post by:
I created a base page class which sets a response filter and the filter injects additional html into the response output stream. The filter works fine and everything works as expected except for the following quirk: When I navigate my browser to another url (a link in the page, a browser favorite...it doesn't mater) and then use the browsers (IE 6) Back or Forward buttons to go back to my filtered page the additional html I had added...
4
1812
by: Thomas | last post by:
I want to be able to implement a filter that manipulates the output from the server... Maybe replacing some words, or highlighting a search string, or some other fancy feature... I want to make this code reusable to all my applications, and by making this as a HttpModule I can implement this feature on existing .Net applications by editing the we.config and nothing else... My problem is that that I can't get this to work.
1
1154
by: Stu | last post by:
Hi, I am working on a CMS that uses html templates with placeholder strings for the content (eg: %%Content%%). I want to get the web control working on a blank page. Then intercept the page as it is being rendered to the browser and place the template around the output. How do I intercept and change the html as it is being rendered to teh browser?
1
1092
by: Stu | last post by:
Hi, I am trying to grab the page output so I can do some html processing before the page is sent to the browser. I found a post somewhere which suggests that this would grab the page content immediately before it is sent to the browser. I have added this to the page but the sub is not called. Does anyone know how to get this going?
5
6081
by: Ritesh Raj Sarraf | last post by:
import os, sys, logging logger = logging.getLogger("my_app") conerr = logging.StreamHandler(sys.stderr) conerr.setLevel(logging.DEBUG) conerr_formatter = logging.Formatter('%(levelname)s %(message)s') conerr.setFormatter(conerr_formatter) console = logging.StreamHandler(sys.stdout)
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...
5
3330
by: amit.uttam | last post by:
Hey everyone, I've recently jumped big time into python and I'm working on a software program for testing automation. I had a question about proper logging of output. What I would like is: 1. a function syslog (to log output to log file only) 2. a function stdout (to log output to stdout only) 3. a function sslog (to log output to both log and stdout)
0
9583
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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,...
1
9990
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
9860
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
7406
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
6668
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
5297
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...
1
3955
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 we have to send another system
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.