-1

Possible Duplicate:
What is the 'page lifecycle' of an ASP.NET WebForm?

I have studied a lot of article on execution process in .net. What i found is that

Language code(C#,vb, j# etc.) ----> language compiler ---> MSIL code -----> now this MSIL code is processed by just-in-time which is inside CLR

this process is okay for class library execution or windows app or console app but in asp.net we have a .aspx page + a code behind (c#, vb etc.)...In that case how this execution process takes place ?

Community
  • 1
  • 1
Ankush Jain
  • 71
  • 2
  • 9
  • From the [faq] - "*Your questions should be reasonably scoped. If you can imagine an entire book that answers your question, you’re asking too much.*" This type of question is not really a good fit for this site. There are plenty of books / article / resources out there to learn about this topic. Of course, that's all just my opnion. – Josh Darnell Feb 27 '12 at 18:21

2 Answers2

3

ASP.NET will process your ASPX and code-behind file like this:

  1. Load ASPX from disk
  2. Parse ASPX code into a code-dom that can be edited through extensibility hooks
  3. Save that code into a C# file on disk
  4. Use csc.exe to compile this code into an assembly. Everything in your /bin folder will be available as a reference.
  5. Load the assembly.
  6. Load all bin assemblies.
  7. Invoke the rendering code inside the freshly compiled assembly. This will start the usual process of JITing and executing.
usr
  • 168,620
  • 35
  • 240
  • 369
  • 1
    i think there must be a compiler to process aspx pages but you are saying that both aspx and c sharp code goes to csc.exe...please clarify – Ankush Jain Feb 27 '12 at 18:19
  • I improved the answer. I hope it helps. – usr Feb 27 '12 at 18:25
  • 2
    He does have the clarification here - an ASPX file is converted to C# along with the code behind (both are two partial classes forming a single complete class). Then the compiler is used to create the IL code. – Kevin Brock Feb 27 '12 at 18:26
  • 1
    The generated class from the ASPX file inherits the class in CodeBehind. All code blocks, Eval/Bind expressions, Resource expressions, declared in markup won't be accessible from code behind (go in that generated class). – Adrian Iftode Feb 27 '12 at 18:50
0

It's probably a bit too much to go into detail here, but you will want to look up the ASP.Net Page Lifecycle:

http://msdn.microsoft.com/en-us/library/ms178472.aspx

Additional info as suggested by commenters: Before the actual execution, IIS compiles the code in both the page and its code behind or retrieves the compiled code from a compilation cache (ASP.Net dynamic compilation); more info here:

http://msdn.microsoft.com/en-us/library/ms366723.aspx

Dirk
  • 2,348
  • 17
  • 23