Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > httphandler to intercept pages before sent to user

Reply
Thread Tools

httphandler to intercept pages before sent to user

 
 
=?Utf-8?B?cnBhbGU=?=
Guest
Posts: n/a
 
      12-15-2004
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 = "httphandlerRedir.DomainHandler ,
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

 
Reply With Quote
 
 
 
 
Matt Berther
Guest
Posts: n/a
 
      12-16-2004
Hello rpale,

You might try PageParser.GetCompiledPageInstance(url, context)... I'm not
sure if that's what you're after, but thats what the IHttpHandlerFactory
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 = "httphandlerRedir.DomainHandler
> ,
> 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



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      12-16-2004
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.GetCompiledPageInstance 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.)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to intercept the XML requests sent by the proxy? Gabriel Lacatus ASP .Net Web Services 1 05-10-2006 10:41 AM
HELP: intercept request and redirect before page is laoded super todd ASP .Net 1 05-23-2005 10:10 PM
Is there a way to intercept page HTML source before it's served LP ASP .Net 5 02-19-2005 08:18 PM
Can you intercept the url request before a 404 error occurs? =?Utf-8?B?UlVTU0VMTCBNQ0dJTk5JUw==?= ASP .Net 1 07-14-2004 02:45 PM
Intercept html before rendering Adam Smith ASP .Net 6 05-27-2004 09:15 AM



Advertisments