Moving to ASP.NET


Moving to ASP.NET from ASP or another Web application technology not only requires changes to code but also might require some changes to the way your applications are designed. You need to be aware of some nuances so that you can plan ahead for them.

  • If you’ve been working with ASP since version 1, you know that the original version of ASP recommended that methods be defined in <script runat=“server”> blocks. However, most developers—myself included—rarely followed this guideline. Had we followed it, our code would migrate much more easily! If you’re still authoring ASP files but anticipate moving them to ASP.NET in the future, define all methods and functions in <script runat=“server”> blocks.

  • If you’re still authoring ASP files, don’t use render functions.

  • If you’re still authoring ASP files and plan to eventually convert them to ASP.NET, use parentheses for all functions and methods.

  • An additional benefit of server controls is that they can intelligently render the appropriate markup based on the device or browser making the request. For example, the DataGrid’s rendering will be slightly different for Internet Explorer than for NetScape. The display is identical, but the DataGrid can intelligently make choices about which display is better for each browser to guarantee correct rendering.

  • In addition to dimensioning all your variables, it is also recommended that you type all of your variables: Dim iLoop As Integer. By simply typing your variables you can increase the performance of your application. You can enforce this by requiring the Option Strict Microsoft Visual Basic .NET compiler option rather than the Option Explicit option.

  • Do not use default properties if you are still authoring ASP or Visual Basic 6 code that you intend to migrate. Default properties are no longer supported in Visual Basic .NET.

  • You shouldn’t have any reason to use include files in ASP.NET. Instead use server controls or user controls, or move your code into compiled classes.

  • ASP.NET is designed to allow different versions to run side by side. That is, ASP.NET 1.0 and ASP.NET 1.1 (and in the future ASP.NET 2.0) can all run on the same server without affecting one another.

  • ASP.NET uses a different thread for each request and additionally creates new instances of all required pages and classes on each request. This prevents you from having to worry about multithreading issues, but you still gain the benefits of a multithreaded environment.

  • Using ASPCompat will degrade the performance of the ASP.NET page.




Microsoft ASP. NET Coding Strategies with the Microsoft ASP. NET Team
Microsoft ASP.NET Coding Strategies with the Microsoft ASP.NET Team (Pro-Developer)
ISBN: 073561900X
EAN: 2147483647
Year: 2005
Pages: 144

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net