Although Microsoft® Visual Studio® .NET makes it easy to create and work with Web Forms pages using the ASP.NET code-behind model, you might find yourself working with single-file Web Forms pages by circumstance or by preference. This article gives an overview of the differences between the two models, describes how to work with single-file Web Forms pages in Visual Studio, and shows you how to convert single-file .aspx pages to code-behind Web Forms pages.
There are a few differences in the processing of code-behind and single-file pages.
| Code Behind | Single File |
| The HTML and controls are in the .aspx file, and the code is in a separate .aspx.vb or.aspx.cs file. | The code is in <script> blocks in the same .aspx file that contains the HTML and controls. |
| The code for the page is compiled into a separate class from which the .aspx file derives. | The .aspx file derives from the Pageclass. |
| 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 .dllfile is created and executed. | 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. |
[Quote MSDN: Working with Single-File Web Forms Pages in Visual Studio .NET]
No comments:
Post a Comment