What is the difference between inline code and code behind in asp.net?

 Posted by Allemahesh on 7/23/2013 | Category: ASP.NET Interview questions | Views: 5903 | Points: 40

1. In Code Behind, the HTML and controls are in the .aspx file, and the code is in a separate .aspx.vb or .aspx.cs file.
In Single File, the code is in <script> blocks in the same .aspx file that contains the HTML and controls.
2. In Code Behind, the code for the page is compiled into a separate class from which the .aspx file derives.
In Single File, the .aspx file derives from the Page class.
3. In Code Behind, all project class files (without the .aspx file itself) are compiled into a .dll file, which is deployed to the server without any source code. When a request for the page is received, then an instance of the project .dll file is created and executed.
In Single File, When the page is deployed, the source code is deployed along with the Web Forms page, because it is physically in the .aspx file. However, you do not see the code, only the results are rendered when the page runs.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response

More Interview Questions by Allemahesh