Whenever I create project File-->New --> Project ---> Web Application create in cs file show codebehind file
but oterwise I create project File-->New --> Website--> mean
i will get Codefile.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.Parser Error Message: Could not load type 'NWO.Web.Global'.
Source Error:
| Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="NWO.Web.Global" Language="C#" %> |
Mohammed HameedPosted Oct 24, 2013, 7:57 AM
CodeFile - The .cs file will be attributed as CodeFile in Page directive in case of Website project. This means your .cs file will not be compiled at design time but it gets compiled automatically at Runtime and the compiled file will be saved in Temp location.
CodeBehind - The .cs file will be attributed as CodeBehind in Page directive in case of Web Application project type. This means the .cs file will be compiled at design time itself and embedded into the DLL automatically (Note: the DLL will be in the bin folder).
Hope it was understandable. If still you have any queries please let me know. I would be glad to help you out further.
SenthilkumarPosted Apr 12, 2012, 5:26 AM
There are two type to handle the server side code.
1) Code behind
2) Inline
Code behind:
The code behind is a separate file with the extension of (.aspx.cs or .aspx.vb) .cs or .vb. Because asp.net application allows to create in either VB or C#. It can be selected while creating application or adding page or you can change it in the page directives.
The code behind separates the logic and design separately in order to increase the readability, understandatbility and scalability. It will be easy to understand and the designers can work on .aspx page and developers can write the code in the code file.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default6.aspx.cs" Inherits="Corner_Default6" %>
The page directive has the codefile property which indicates the name of code file. The language can be either C# or VB.
Inline:
Inline is the server side code can be part of the file in .aspx (design page) and it will be separated by the script section.
It may be bit confuse with the logic and designs altogether in the same file.
Inherits and your issue:
The inherits is the property in the page directives and usually it will be named with the folder and name of the file.
Suppose your file created in the root folder then
inherits="Default1"
If your file created with in the folder then
inherits="NewFolder1_Default1"
You can check accordingly whether you have changed any name of the folder structure or files may be moved.
MuthuMari MPosted Apr 12, 2012, 4:53 AM
pls refer this url
http://forums.asp.net/t/1088894.aspx/1
http://stackoverflow.com/questions/73022/codefile-vs-codebehind
thanks
If this post is useful then mark it as "Accepted Answer"