What happens when default.aspx page is requested for the first time?
.net is pure a pure Object Oriented Framework.
_default is a class which extends Page.
Without instantiating, Pre-Init,Init,Load cannot be called.
So How _default class is instantiated?
Who is responsible for that?
I want to know very detailed technical steps?
Pleasa clarify!
The ASP.Net framework identifies that the request is for the page
default.aspxand examines the markup of the corresponding .aspx file – using this it generates a class based on that markup. The base class for that class is identified in the@Pagedirective:It then creates an instance of that generated type – this type inherits from the given base class, in this case
WebApplication1._Default.The ASP.Net framework doesn’t normally (ever?) directly create an instance of your “code behind” class.
You can see this for yourself by debugging a simple web application:
This explains why event handlers only need to be marked as protected instead of public.
If you are really keen you can get the path to the generated assembly using
this.GetType().Assembly.CodeBase, make a copy of that file and inspect the generated class in something like IL Spy.