473,394 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

HTTP Modules and global.asax

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
Nov 18 '05 #1
2 2407
i haven't seen the article, but i am guessing they were speaking in terms of
mapping the event to your own function. got the article nearby? that would
help

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Norton" <th********@hotmail.com> wrote in message
news:ei**************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #2
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


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: WJ | last post by:
Is the "Application_Start" event on Global.asax created by the "very first user" who visits the Asp.Net web site ? Or is it started per user ? If it is the first case, how do you flush the global...
2
by: Dave | last post by:
In KB article 308000 HOW TO: Create an ASP.NET HTTP Module Using Visual Basic .NET (http://support.microsoft.com/default.aspx?scid=kb;EN-US;308000), a simple HTTP Module is created which, among other...
12
by: John M | last post by:
Hello, On Microsoft Visual Studio .NET 2003, I want to use some global elements, that can be used in each one of my pages. i.e I put a oleDBConnection on global.asax.vb How can I use it...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
4
by: John A Grandy | last post by:
I installed VS05 RC , created a new Web Site , but I do not see Global.asax , and I do not see Global.asax.cs in the App_Code dir ......
1
by: GaryDean | last post by:
I notice that the global.asax in v2 is inline. because of this I can't say Session = conn; The compiler will accept it but at runtime the exception says "Session State is not available in this...
4
by: Al Santino | last post by:
Hello, I've created a simple C# web services project using Visual Studio 2005. My service compiles and runs correctly when called by remote clients. I'm able to step through the service in the...
3
by: thomson | last post by:
Hi All, i do have an website with the URL http://localhost/application/ASEAN-ANZ, Once i hit the application, it goes to the Global.asax. but after that if i tried to change the URL...
4
by: Joe | last post by:
Hello all! I added a Global.asax to my application. I'm using the Application_BeginRequest event. Everything works fine in my development enviorment but when I publish the web site the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.