0

Hi All,

I need some help understanding HTTP Modules a lot better.

At the moment I understand creating the Init and Dispose functions and
making the Init function include an event handler.
Its only in the Event handler that I am clueless as to the logic
of getting something to work for you. I am aware of the events available at ones disposal. However can someone explain what goes on in the event handler. I have looked at existing examples of what handlers might be used for but am clueless about the logic.
Thanks very much

p.s also where do i locate the bin file so i can deploy the class module?

public class Module:IHttpModule
{

public void Dispose()
{

}

public void Init(HttpApplication context)
{
app.BeginRequest += new EventHandler(OnBeginRequest);
}

// event handlers
public void OnBeginRequese(object o, EventArgs ea)
{
//Here is what I have no idea what to do.
}
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Fungus1487
0

the bin file should be generated with your project. Are you using VS? or are you writing this by hand.

The logic you have is quite simple, the "Init" method is being called and creating a handle of the OnBeginRequest method which should have a set signature.

You are then "+=" appending the handle to the BeginRequest event. When this event is triggered it will loop through all handles that have been added to it (system and user) and trigger them.

This will then fire any code you have in your "OnBeginRequest" method.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.