How does ASP.NET parse an ASPX file into executable code?
How does ASP.NET parse an .aspx, .ascx or .master file into executable code?
I have a brain and a copy of .NET Reflector, so if someone could t开发者_Go百科ell me where to look, that is sufficient.
You're looking for the TemplateParser
and TemplateBuilder
classes and their derivatives.
You can download the reference source for the .Net framework, which includes comments and will be more readable than Reflector.
It uses the asp.net syntax parser (system.web.dll) compilation namespace, and codedom for the language of the file to generate source files. Then compiles them to a dll with the codedom provider places them in the asp.net temporary files dir and loads it.
One good way to learn more on the life cycle is to use the debugger in Visual Studio 2010 and set a break point somewhere. Then show the Call stack (Debug->Windows->Call Stack). Then right click somewhere in the call stack trace and choose "Show External Code". There you can see what's going on in the managed world.
精彩评论