HttpModules and the methods in your Global.asax are different things.
Your Global.asax is an instance of HttpApplication,
http://msdn.microsoft.com/library/de...ClassTopic.asp.
HttpApplication exposes a series of events that you can tie event
handlers to, such as AuthenticateRequest. As the MSDN help for
HttpApplication states,
"An application executes events that are handled by modules or user code
defined in the global.asax file"
In your global.asax.cs you have the auto code generated methods that
VS.NET creates. You don't have to have them there, and they don't have
to be named based on your HttpModule names. They are event handlers for
the given events that HttpApplication exposes. Your HttpModules will
also have their own event handlers to do stuff during the events that
HttpApplication exposes, but the global.asax.cs event handler naming is
totally arbitrary.
I found a good introduction to HttpModules and HttpApplication event
handling from the URL Rewriting article that Microsoft has,
http://msdn.microsoft.com/library/de...lrewriting.asp.
Worth a read if you haven't already...helps to understand the difference
betwen the two, and shows you how to incorporate URL rewriting...good
article.
Shan
Norton wrote:
I understand how to create HTTP modules that can be used to add
functionality to a website but there are a few things I don't understand.
If I create an HTTP Module and I want it to intercept a call to
AuthenticateRequest, I know that in my init function for my HTTP module, I
can add a handler to this method name and then use this event handler
delegate to call my own function.
I saw some sample code though that mentioned (for some reason I'm not sure)
that in the global.asax, you could have code (a function name) like
'MyHTTPModuleName_AutheticateRequest'.
Does this make any sense at all, or maybe I was seeing things? Why would you
add a function to global.asax that had the module name in front of it if you
intend to use a module to contain the logic?
Thanks!
Norton