开发者

How does ASP.NET parse an ASPX file into executable code?

开发者 https://www.devze.com 2023-02-16 11:36 出处:网络
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.Yo

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号