Joe Smith
Joe Smith

Reputation: 139

Does code in aspx page get compiled in a web application?

Let me just start by saying, if anyone knows of a good article that talks about this subject, please point me towards it.

Does code in an .aspx page (in between <% %> tags) get compiled in a web application or is it treated like markup where you can just change it without recompiling the solution? Does compiling only compile the code behind code in the .cs and designer.cs files ?

Upvotes: 4

Views: 4765

Answers (2)

Craig
Craig

Reputation: 4383

If you're developing in a 'Web Application Project' (as opposed to 'Web site') then any change to class (.cs), code-behind file (.aspx.cs), designer files, etc (basically anything that isn't markup or static files like .htm) would require a rebuild in Visual Studio.

Upvotes: 4

Oded
Oded

Reputation: 499262

All code within a .aspx file, in or out of code blocks (<%%>) gets compiled.

Changing an .aspx file will cause IIS to recompile it on the next request.

See MSDN - ASP.NET Dynamic Compilation.


Update (following comment):

As for development work - pretty much the same happens when you use the dev web server to view the page. You do not have to recompile the solution/project, but the page will get recompiled dynamically.

Upvotes: 2

Related Questions