I read through the previous post: http://stackoverflow.com/questions/73022/codefile-vs-codebehind, but I'm still confused on which I should use. It sounds like CodeFile is the newer option that should be used, yet VS2010 generates CodeBehind when creating a new Web Form.
+1
A:
It depends on your template, check out web site vs. web application. I tend to prefer web application for several reasons, but that is up to you. If you see code-behind, you probably have selected that template.
Brian
2010-04-06 15:38:24
Okay, that's what I did. Just wanted to verify that was the reason. Does the code-behind require pre-compilation, or will new code get compiled on the fly?
Donald Hughes
2010-04-06 15:49:23
Websites can be precompiled (or 'published'), otherwise pages get compiled on the fly. I also prefer web application projects however and would recommend them for any reasonable sized project.
richeym
2010-04-06 17:18:00
Code-behind itself doesn't precompile but the code-behind is compiled into a single DLL, but web sites are dynamically compiled at runtime as mentioned by @richeym. Precompilation can be done for both project types, as it also compiles the markup too, so there isn't the initial page compilation hit.
Brian
2010-04-06 18:51:22