Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to hook httpmodule and page event together?

Reply
Thread Tools

How to hook httpmodule and page event together?

 
 
=?Utf-8?B?d2FsdGVy?=
Guest
Posts: n/a
 
      03-30-2006
Hi there , for sure httpmodule can be hooked up with HttpApplication event.
But I'm wondering if it's poissible to trigger a httpModule in the page event
,like Page.Init().

Since request handler will be different among http/aspx, I hardly see it's
possible. But may be someone knows. Reason I want to do this is because I
like the plugin model provided by asp.net framework, but this time is just
for page. If I can hook httpmodule and page event together, then I can make
the page become plugable.

Appreciate any inspiriting thought.

Walter

 
Reply With Quote
 
 
 
 
Bruno Piovan
Guest
Posts: n/a
 
      03-30-2006
Walter,
take a look at this code I wrote...
it will handle the PageInit event for all pages.....

I hope it helps..

Bruno


Public Class MyModule

Implements IHttpModule

Public Sub Dispose() Implements System.Web.IHttpModule.Dispose

End Sub

Public Sub Init(ByVal context As System.Web.HttpApplication) Implements
System.Web.IHttpModule.Init

AddHandler context.PreRequestHandlerExecute, AddressOf
PreRequestHandlerExecute

End Sub

Sub PreRequestHandlerExecute(ByVal sender As Object, ByVal e As
System.EventArgs)

AddHandler CType(CType(sender, HttpApplication).Context.CurrentHandler,
Page).Init, AddressOf PageInit

End Sub

Private Sub PageInit(ByVal sender As Object, ByVal e As System.EventArgs)

Dim p As Page = CType(sender, Page)

p.Response.Write("Hello")

End Sub

End Class




"walter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi there , for sure httpmodule can be hooked up with HttpApplication
> event.
> But I'm wondering if it's poissible to trigger a httpModule in the page
> event
> ,like Page.Init().
>
> Since request handler will be different among http/aspx, I hardly see it's
> possible. But may be someone knows. Reason I want to do this is because I
> like the plugin model provided by asp.net framework, but this time is just
> for page. If I can hook httpmodule and page event together, then I can
> make
> the page become plugable.
>
> Appreciate any inspiriting thought.
>
> Walter
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?d2FsdGVy?=
Guest
Posts: n/a
 
      03-31-2006
Hi Bruno,you answer is awesome. Thanks

"Bruno Piovan" wrote:

> Walter,
> take a look at this code I wrote...
> it will handle the PageInit event for all pages.....
>
> I hope it helps..
>
> Bruno
>
>
> Public Class MyModule
>
> Implements IHttpModule
>
> Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
>
> End Sub
>
> Public Sub Init(ByVal context As System.Web.HttpApplication) Implements
> System.Web.IHttpModule.Init
>
> AddHandler context.PreRequestHandlerExecute, AddressOf
> PreRequestHandlerExecute
>
> End Sub
>
> Sub PreRequestHandlerExecute(ByVal sender As Object, ByVal e As
> System.EventArgs)
>
> AddHandler CType(CType(sender, HttpApplication).Context.CurrentHandler,
> Page).Init, AddressOf PageInit
>
> End Sub
>
> Private Sub PageInit(ByVal sender As Object, ByVal e As System.EventArgs)
>
> Dim p As Page = CType(sender, Page)
>
> p.Response.Write("Hello")
>
> End Sub
>
> End Class
>
>
>
>
> "walter" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi there , for sure httpmodule can be hooked up with HttpApplication
> > event.
> > But I'm wondering if it's poissible to trigger a httpModule in the page
> > event
> > ,like Page.Init().
> >
> > Since request handler will be different among http/aspx, I hardly see it's
> > possible. But may be someone knows. Reason I want to do this is because I
> > like the plugin model provided by asp.net framework, but this time is just
> > for page. If I can hook httpmodule and page event together, then I can
> > make
> > the page become plugable.
> >
> > Appreciate any inspiriting thought.
> >
> > Walter
> >

>
>
>

 
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
Hook to AJAX End Event on Client Side Lit ASP .Net 5 08-23-2007 08:42 AM
HttpModule Error event doesn't fire!! kgadia@gmail.com ASP .Net 2 07-31-2006 03:55 PM
HttpModule - OnAuthenticate event Robert Rolls ASP .Net 0 06-21-2005 10:45 AM
what event should I hook to for this? djc ASP .Net 7 11-23-2004 07:27 PM
Passing Variables between Web Page Events and HttpModule Events shiv ASP .Net 0 11-21-2003 04:29 PM



Advertisments