Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can anyone point me at some information about what the object and EventArgs parameters are in the event handlers found in Global.asax. Is anything useful passed in these parameters? Can either of them be cast to a more useful sub-type?

I don't seem to be able to find anything about the parameters to these event handlers anywhere.

Kind wishes, Patrick
Posted

1 solution

Start here: http://msdn.microsoft.com/en-us/library/system.web.httpapplication.beginrequest(v=vs.100).aspx[^]

As you can see these are event handlers, thus they are following the event pattern of c#[^], thus they have general parameters.
The sender will be the HttpApplication firing the event - this is mostly used. The EventArgs[^] typed parameter my hold several descendants of the base type, but as I know in global.asax it is rarely used.
So I suggest you concentrate on the sender.
 
Share this answer
 
Comments
Patrick Skelton 13-Apr-13 4:51am    
Thank you for telling me the type of the sender parameter. I would still like to know the sub-class of the event arguments. It must be documented somewhere. If not, shame on you Microsoft.

I have had trouble looking up this information in other event handlers, even in desktop Windows applications. It seems to be an area of documentation that Microsoft regards as optional or unimportant, but it is anything but. How could you work with the mouse events, for example, without knowing to cast the parameter to a MouseEventArgs?

I'll try using typeof() in the debugger, to see if I can find anything useful.

- Patrick
Zoltán Zörgő 13-Apr-13 13:18pm    
Yes, you are right. This is not well documented as think. But the debugger is happy to help you :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900