the difference between CodeFile and Codebehind
Codebehind
Specifies the name of the compiled file that contains the class associated with the page. This property cannot be used at run time.
Specifies the name of the compiled file that contains the class associated with the control. This attribute isn't used at run time.
Specifies the name of the compiled file that contains the class associated with the page, and the code in all CS is packaged into the DLL when it is compiled. This property cannot be used at run time. This property is provided for compatibility with previous versions of ASP to implement code-behind functionality.
CodeFile
Specifies the path to the code-behind file that refers to the page. This property is used with the Inherits property to associate a code-behind source file with a Web page. This property is valid only for compiled pages. For example, to create a new website in VS2005 you will find that the compilation is much slower than the Web application, but you can see the effect by modifying the code without having to refresh the page with the overall compilation.
Specifies a path to the referenced Code-behind file for the control. This attribute was used together with the Inherits attribute to associate a Code-behind source file with a user control. The attribute is valid only for compiled controls.
What I'm encountering here is that the entire Web project is compiled into components, but the ASPX page is defined as follows:
<%@ page codefile= "* * *" inherits= "* * *"%>
At this point, ASP. NET needs to find the file specified in CodeFile in order to compile dynamically, but can not find, so reported the above error.
For the development, that is, the page logic code CS file exists, the subordinate two kinds of writing no problem.
<%@ page language= "C #" autoeventwireup= "true" codebehind= "Index.aspx.cs" inherits= "Community.IndexHomePage.index "%>
<%@ page language= "C #" autoeventwireup= "true" codefile= "Index.aspx.cs" inherits= "Community.IndexHomePage.index"% >
However, after deploying to the site, we will not deploy CS file, this time, the latter method will be reported to find the error of the file. Unless you have the CS also deployed, otherwise it will be reported compile-time errors, files cannot be found ...
The difference between CodeFile and codebehind