Front Controller / IHttpModule

M

moid

Sir we are implementing front controller in asp.net.
we implement three event-handler
1. PreRequestHandlerExecute
2. PostRequestHandlerExecute
3. BeginRequest

we just want to initialize the page, but dont want to load it.
After BeginReq the page should Load.

becuse we need to fill Datagrid through Command
and then load it.

is there any event in httpmodule that initialises page init events
or is there some thing we are missing in whole here
please help me.

Thanks and Regards.
Moid


------Code:-------------

Public Class Handler
Implements IHttpModule

Public Sub Init(ByVal ctx As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler ctx.PreRequestHandlerExecute, AddressOf context_PreRequestHandlerExecute
AddHandler ctx.PostRequestHandlerExecute, AddressOf context_PostRequestHandlerExecute
AddHandler ctx.BeginRequest, AddressOf context_BeginRequest
End Sub 'Init

Private Sub pageInit(ByVal [source] As [Object], ByVal e As EventArgs)
End Sub

Private Sub context_BeginRequest(ByVal [source] As [Object], ByVal e As EventArgs)
Dim application As HttpApplication = CType([source], HttpApplication)
Dim context As HttpContext = application.Context.Current
Dim session As HttpSessionState = context.Session

Try
Dim command As Command = CommandFactory.Make(context.Request.RawUrl)
If Not (command Is Nothing) Then
command.Execute(context)
Else
End If
Catch
End Try

End Sub


Public Sub Dispose() Implements IHttpModule.Dispose
End Sub

Private Sub context_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
'...Code
End Sub 'context_PreRequestHandlerExecute


Private Sub context_PostRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
'...Code
End Sub 'context_PostRequestHandlerExecute

End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top