Compilation of ASP.NET page classes and in-line .NET code

G

Guest

I know that ASP.NET code-behind classes are compiled into IL at project build
time, but what about the .aspx files themselves? I believe that the .aspx
files are compiled into IL at runtime, upon access to the website, correct?

What about in-line .NET code inside <% ... %> blocks in .aspx files, are
they compiled into IL at runtime too?

Finally, if the answer to the first question is yes, does the web server
actually execute the CS or VB.NET compiler at runtime to do this compilation?

thanks
 
K

Kevin Yu [MSFT]

Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know when the .NET code
inside <%%> block is going to be compiled. If there is any
misunderstanding, please feel free to let me know.

As far as I know, your assumption is correct. The web server will user CS
or VB.NET compiler at runtime to compile the code inside the code block.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
G

Guest

Hi Kevin thanks much for the quick response. You definitely answered part 2
of my question in terms of what happens to the inline script, so I appreciate
that. The other piece is the .aspx pages themselves, regardless of inline
script. I want to understand the compilation process/behavior for the .aspx
pages and see if it is what I described.

regards,
Matt
 
K

Kevin Yu [MSFT]

Hi Matt,

When a request is sent to the server, the server checks to see if the page
has been compiled before. If it is the first time, it compiles and put the
complied files to bin folder. Next time, it will get the complied stuff
from bin folder directly. Then it renders aspx pages and repond to the
client.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top