ASP.NET allows arbitrary amounts of code to be embedded into a page. If that code is lengthy, then the overall page can be harder to read. The code itself does not fully benefit from IDE features, and the HTML content of the page is harder to read due to being obstructed by the code.

Consider updating the page to use the Code-Behind Page Model (see ASP.NET Web Page Code Model for details). In this model the markup and programming code are stored in separate files for easier maintenance.

This example uses a large amount of code in the middle of a page.

In the following example, the code is stored in a code-behind file. This separation of the HTML content from the VB.Net content makes the intention of the ASP page clearer and also simplifies reuse of the code.

  • MSDN: Introduction to ASP.NET and Web Forms, ASP.NET Page Syntax, ASP.NET Web Page Code Model.