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

风流意气都作罢 提交于 2019-12-13 19:32:40

问题


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 tell me where to look, that is sufficient.


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/5274272/how-does-asp-net-parse-an-aspx-file-into-executable-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!