When I add Global.asax to the page, five methods (Application_Start,Session_Start,...) are added to the page automatically. But where they come from ? I looked at the application class and its interfaces but I couldnt find them at all.
当我将Global.asax添加到页面时,会自动向页面添加五个方法(Application_Start,Session_Start,...)。但他们来自哪里?我查看了应用程序类及其接口,但我根本找不到它们。
Thanks in advance,
提前致谢,
4 个解决方案
#1
8
These methods don't come from anywhere, they exist only on your class. However, the ASP.NET runtime looks for methods in your class with these names and calls them at appropriate times in the application/page lifecycle.
这些方法不是来自任何地方,它们只存在于您的班级。但是,ASP.NET运行时在类中查找具有这些名称的方法,并在应用程序/页面生命周期中的适当时间调用它们。
#2
5
Those events are bound by convention, see Life Cycle Events and the Global.asax file.
这些事件受约定约束,请参阅生命周期事件和Global.asax文件。
#3
2
See this page under "Life Cycle Events and the Global.asax file"
请参阅“生命周期事件和Global.asax文件”下的此页面
#4
0
Global.asax file having total 19 events and its all details you can fine much more on msdn...
Global.asax文件共有19个事件及其所有细节,你可以在msdn上更好...
#1
8
These methods don't come from anywhere, they exist only on your class. However, the ASP.NET runtime looks for methods in your class with these names and calls them at appropriate times in the application/page lifecycle.
这些方法不是来自任何地方,它们只存在于您的班级。但是,ASP.NET运行时在类中查找具有这些名称的方法,并在应用程序/页面生命周期中的适当时间调用它们。
#2
5
Those events are bound by convention, see Life Cycle Events and the Global.asax file.
这些事件受约定约束,请参阅生命周期事件和Global.asax文件。
#3
2
See this page under "Life Cycle Events and the Global.asax file"
请参阅“生命周期事件和Global.asax文件”下的此页面
#4
0
Global.asax file having total 19 events and its all details you can fine much more on msdn...
Global.asax文件共有19个事件及其所有细节,你可以在msdn上更好...