The difference between CodeFile and codebehind

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.