ok we know that .net app cannot be directly converted to machine code, first it si compiled to MSIl which is converted to machine specific code by JIT on request, once but what about asp.net app ? e.g. i decelop a web page and put it on my laptop (working as a web server), now what about it ? i mean that process of coversion from SC to MSIL and then MSIL to Machine code ? how it does ?

The things is that Your Codes(C#/VB.Net/J#/VC++) are first compiled by their respective compiler for example csc.exe in case of C# to an intermediate language MSIL[Microsoft Intermediate Language]. It is done to make .net application Environment Independent. You can see this MSIL using ildasm.exe in Visual Command Prompt. Next this MSIL is converted into Machine Code ie., bit byte format[001100] so that it can be understood by the system using JIT[Just in time compiler].

yeah i know that bro but what about asp.net app ? how and when does it compile its code to MSIL and then to native via JIT ?
in terms of web app.

i'm getting more confused even :(

I think this article will help you understand how asp.net works with respect to compiling into IL and so on..

Understanding ASP.NET Dynamic Compilation, first two paragraphs in the introduction gives a high level explanation.

I have read this book from APRESS Pro ASP.NET 4.5 in C# which had quite of bit of information about this topic. I thought the book was very good. Actually, I read this one first and thought it was very good as well: Beginning ASP.NET 4.5 in C#

Your asp.net skills may go beyond the beginning book, but both books have chapters dedicated regarding asp.net life cycles, and a lot of core topics not just a book about code samples.

+1 for the Beginning ASP.Net and Pro ASP.Net books. They are written by Matthew Macdonald and are the best book in the market. Even in the official asp.net site they refer the same book.

Coming to your question:

how and when does it compile its code to MSIL and then to native via JIT ?

I have already discussed about how and Regarding when It occurs when you run your asp.net application[ie, during runtime]

Please Refer these articles as in MSDN..

http://msdn.microsoft.com/en-us/library/c5tkafs1(v=vs.90).aspx

http://msdn.microsoft.com/en-us/library/ht8ecch6(v=vs.90).aspx

Please Let me know incase of any discrepancies. Thanks

Thanks guys, especially JorGem.
i got it, so msdn says that it compiles automaticalyy when a user makes first request to the server and then a requested snippet is converted to native by JIT and after that only MSIL to native process takes place on each request but not for the code for which a request has already been made but VS has options for pre compilation and thats beneficial because precompiled code would save the time of compilation on first request and also minimizing the chance of error.

Thanks guys !

precompiled code would save the time of compilation on first request and also minimizing the chance of error.

Yes, precompiling will save time on the first request, but does require that anytime to make a change to the source files, you would have to recompile.

so if i precompile my app and deploy it then would it lose it ability to automatically compile ? i read somewhere that chanegs are adjusted automatically mean when source code changes then it get itseld adjusted.
so would it lose because of pre complilation theory ?

I'm not sure what you mean but there are two options for compling a web site if you desire to do so...

a partial compile which compiles only the .vb/.cs code behind source files. This option allows you to modify your .aspx pages without having to recompile.

A full compile of your site. This option best performance for that first connection, but any changes will require you to recompile before you deploy again.

Keep in mind that it only affets the first connection. After that first connection, there is no difference whether you precompiled or not.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.