Solution:<% @ PageCodeFile = "***" Inherits = "***">
At this time,ASP.netYou need to findCodeFileFor dynamic compilation, but the above error is reported.
For development, that isLogic code of the pageCsWhen the file exists, there are no problems with the two writing methods.
<% @ 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 the site is deployed, we will not deploy it.CsFile. At this time, the next method will report the error that the file cannot be found. Unless youCsOtherwise, a compilation error will be reported and the file cannot be found....
Inherits,CodeFile,CodeBehindDifference
650) this. width = 650; "style =" border-bottom: # ddd 1px solid; border-left: # ddd 1px solid; url (/e/u/lang/zh-cn/images/localimage.png) no-repeat center; border-top: # ddd 1px solid; border-right: # ddd 1px solid "src ="/e/u/themes/default/images/spacer.gif "width =" 554 "height =" 52 "word_img =" file: /// C: \ Users \ wpt \ AppData \ Local \ Temp \ msohtmlclip1 \ 01 \ clip_image001.png "/>
Inherits:(Inheritance)
MsdnExplanation: defines the code hiding class inherited from the page. It can be fromPageAny class derived from the class. This feature correspondsCodeFileFeature used together. The latter contains the source file path pointing to the Code hiding class.InheritsFeatures in useC #The Time Zone of the page language is case sensitive.IfInheritsFeatures do not contain namespaces,ASP. NETCheckClassNameWhether the feature contains a namespace.If it contains,ASP. NETWill try to useClassNameFeature namespace LoadingInheritsClass referenced in the feature.This assumptionInheritsFeatures andClassNameFeature uses the same namespace .)
InheritsAttribute is used to define the currentWebHidden code classes inherited by forms(This class isSystem. Web. UI. PageDerived class).
ThisInheritsAttribute is only used for writing in code hiding mode.WebForm, that is, if all your code is inWebForm
<Script runat = "server"> </script>Label, you do not need to use this attribute.
CodeFile
MsdnDescription: Specifies the path of the code hidden file pointing to the page reference.This feature correspondsInheritsThis feature is used together to associate hidden source files with webpages.This feature is only valid for compiled pages.
This feature is used for website projects.
Codebehind
MsdnExplanation: specify the name of the compiled file that contains the class associated with the page.This feature cannot be used at runtime. This feature is usedWebApplication project.
CodebehindThe property is not reallyASP. NETAttribute, inASP. NETIt cannot be found in the document.
It is actually justVisual Studio. NETAttribute,
Visual Studio. NETThis attribute is used to track and manage projects.WebForm and the corresponding code hidden file,
For exampleWebWhen a server control is placed on the form,
Visual Studio. NETTheWebThe code corresponding to the form hides the file and automatically inserts the relevant code.
This article is from the "HDDevTeam" blog and will not be reposted!