473,569 Members | 2,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

httphandler to intercept pages before sent to user

We want to create server-side code that will retrieve the user requested
pages, then manipulate the content of those pages just before being sent back
to the user. We tried the following:

• User requests the page, call it http://www.test.com/testapp/test.aspx
• IIS receives the request
• HttpHandler is called for all .aspx files requested as defined in the
web.config file for this application
<httpHandlers >
<add verb="*" path="*.aspx" type = "httphandlerRed ir.DomainHandle r ,
httpHandleRedir " />
</httpHandlers>
• The handler acts on behalf of the user and makes the request for the
test.aspx web page

• The handler retrieves the content, changes the structure and layout, and
returns this to the user
In the second to last bullet above, … the request for the test.aspx
(GetRequest()) causes another invocation of the httphandler to start as a
different session.

How can the handler make this request without it causing an invocation of
the httpHandler method again?

Is there a method that can be called that will request the page as part of
the same session?

Again, the goal is to be able to manipulate the finally constructed user
pages just before each gets sent back to the user.

Thanks
RP

Nov 19 '05 #1
2 2136
Hello rpale,

You might try PageParser.GetC ompiledPageInst ance(url, context)... I'm not
sure if that's what you're after, but thats what the IHttpHandlerFac tory
that handles Pages uses.

--
Matt Berther
http://www.mattberther.com
We want to create server-side code that will retrieve the user
requested pages, then manipulate the content of those pages just
before being sent back to the user. We tried the following:

. User requests the page, call it
http://www.test.com/testapp/test.aspx
. IIS receives the request
. HttpHandler is called for all .aspx files requested as defined in
the
web.config file for this application
<httpHandlers >
<add verb="*" path="*.aspx" type = "httphandlerRed ir.DomainHandle r
,
httpHandleRedir " />
</httpHandlers>
. The handler acts on behalf of the user and makes the request for
the
test.aspx web page
. The handler retrieves the content, changes the structure and layout,
and returns this to the user

In the second to last bullet above, . the request for the test.aspx
(GetRequest()) causes another invocation of the httphandler to start
as a different session.

How can the handler make this request without it causing an invocation
of the httpHandler method again?

Is there a method that can be called that will request the page as
part of the same session?

Again, the goal is to be able to manipulate the finally constructed
user pages just before each gets sent back to the user.

Thanks
RP

Nov 19 '05 #2
Thanks for Matt's suggestions.

Hi Rpale,

Yes, if you're using a HttpHandler to indirectly router the comming asp.net
request and forward it to different actual pages, you may need to use
Matt's suggestion that use the PageParser.GetC ompiledPageInst ance to
manually compiled the page and get the pagehandler and process the comming
request. However, from your description, you're only want to intercept the
page's output content before they're sent to the clientside.
I think currently we have the following means:
1. If you're not forced to do this in a central point, we can override a
page's Render method so that get the render out html there.

2. If you want to add a central/global hook that intercept all the page's
response content in an asp.net application, maybe we need to use a Response
Filter.

The following blog thread (from Dino Esposito's WebLog ) has mentioned this
and there are some the useful links there:

http://weblogs.asp.net/despos/archiv...01/145436.aspx

Hope helps. If anything unclear, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #3

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

Similar topics

4
2902
by: Sean | last post by:
Hi all, Is it possible to use a custom HttpHandler to handler request that does not provide a specified page? e.g. http://www.aaa.com/there/is/no/such/document I tried to handle this request using a custom HttpModule, but IIS directs the request to an error page(404 file not found) before delegating to ASP.NET.
1
2517
by: Dale Ragan via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Dale Ragan I am running into a problem with an HttpHandler that I have builtto show a progress image on the page getting processed. I amusing Response.Flush and as you know you cannot have aResponse.Redirect after you have flushed the buffered content tothe client. You get...
4
4230
by: Igor K | last post by:
Hi all, I'm developing asp.net website. Most of the pages are aspx, but let's say, some 10% are html. For this html pages i use httphandlers to intercept calls and to perform some job on this pages. Lately I need to access Session state in HttpHandler's code. This seems to be the problem. I searched the internet for some solution, i...
14
2080
by: qwerty | last post by:
Hi, I am using a third party win 2003 iis 6.0 to serve my website. The web site has a httphandler which does some custom jobs. When I try to invoke the httphandler from some url call, it won't start and give a 404 error on the url. I personally create a plain win 2003 iis 6.0 server locally. The
3
1630
by: Martin | last post by:
Hi, I have a number of documents stored on my web server and these documents should not be servered to anybody unless the user is both authenticated and authorized. This authentication and authorization comes from a custom database. To stop users simply requesting the documents directly I have written a http handler to intercept requests...
8
3880
by: bryan | last post by:
I've got a custom HttpHandler to process all requests for a given extension. It gets invoked OK, but if I try to do a Server.Transfer I get an HttpException. A Response.Redirect works, but I really need to avoid the extra round-trip to the client. I've tried Passing the page name, the full URL, and the instance of the handler class to the...
3
1346
by: preport | last post by:
So I wrote an HttpHandler that does a bunch of processing then writes a gif to the HttpContext. What I want to do is have my handler intercept any requests for *random.gif How might I go about getting this to work? Of course my handler works perfect on my dev machine....because I added this to the web.config: <add verb="*"...
7
2675
by: Ty | last post by:
Hi, All- I have a custom httphandler that outputs an image to the browser based upon some user input. I'd like to be able to store information about that image in session and have them accessible to all aspx pages in my project. Session state seems to be working normally in my handler, however, the session variables are not accessible...
4
2923
by: deepa.ravikiran | last post by:
I have created a HttpHandler to intercept *.zip requests, authenticate and authorize user before allowing user to download the file. This works perfectly when I run it from ASP.NET development server (from VS 2005). But when I run it from our web app server (Windows Server 2003-R2, IIS 6.0) it gives me a 404 Page not found error from IIS. I...
0
7695
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...
0
7922
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. ...
0
8119
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...
1
7668
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...
0
7964
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...
1
5509
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...
0
3653
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...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
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

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.