<p>What is the difference between <strong>CodeFile</strong>="file.ascx.cs" and <strong>CodeBehind</strong>="file.ascx.cs" in the declaration of a ASP.NET user control?</p>

<p>Is one newer or recommended?  Or do they have specific usage?</p>

[{'answer_id': 901329, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>Codebehind file need to compile before run but in src we dont need to compile and then run.. just save the file.</p>\n'}, {'answer_id': 954873, 'author': 'Shafqat Ahmed', 'author_id': 115176, 'author_profile': 'https://Stackoverflow.com/users/115176', 'pm_score': 8, 'selected': True, 'text': "<p><strong>CodeBehind</strong>: Needs to be compiled (ASP.NET 1.1 model). The compiled binary is placed in the bin folder of the website. You need to do a compile in Visual Studio before you deploy. It's a good model when you don't want the source code to be viewable as plain text. For example when delivering to a customer to whom you don't have an obligation to provide code.</p>\n\n<p><strong>CodeFile</strong>: You provide the source file with the solution for deployment. ASP.NET 2.0 runtime compiles the code when needed. The compiled files are at Microsoft.NET[.NET version]\\Temporary ASP.NET Files. </p>\n"}, {'answer_id': 17006133, 'author': 'DavidHyogo', 'author_id': 341180, 'author_profile': 'https://Stackoverflow.com/users/341180', 'pm_score': 3, 'selected': False, 'text': '<p>I\'m working with an Application Project in Visual Studio Express 2012 For Web and using .NET 4.0. In the code behind files for my login and change password pages I found a situation where I needed both CodeBehind and CodeFile in the declaration.</p>\n\n<p>If I don\'t add a code file reference like</p>\n\n<pre><code>CodeFile=login.aspx.cs\n</code></pre>\n\n<p>The web page doesn\'t parse and the browser displays a parser error. It doesn\'t matter whether I compile the project or not.</p>\n\n<p>If I don\'t add a code behind reference like</p>\n\n<pre><code>CodeBehind=login.aspx.cs\n</code></pre>\n\n<p>References to Security classes like MembershipUser fail both at compile time and when attempting to use intellisense with an error like "The type or namespace MembershipUser cannot be found". I have added a reference to System.Web.ApplicationServices as required by the .Net 4.0 framework. </p>\n\n<p>I should add that these troublesome files are running in an application within the website created using the IIS Application tool.  When I open the website from Visual Studio I have no difficulty with parser errors or reference errors. This confusion only occurs when I open the application as a project in Visual Studio.</p>\n'}]
['https://Stackoverflow.com/questions/73022', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3420/']