Web Studyaspnet.blogspot.com Babyneed.blogspot.com

ASP.Net Web Developer Guide

Power By: eXTReMe Tracker Powered by Blogger  
 
 
 
 

 

 
Important Links
 
   
     
 
Sitemap
 
   
   
 
Reference
 
   

Saturday, February 04, 2006

Upgrading from Classic ASP (Chapter 1)

Many ASP developers will have years and years’ worth of historical code, and thousands of live Web sites are running happily. As mentioned previously, the installation of the .NET Framework will not stop anything from working, so just by installing the software you are not forcing a decision to upgrade.What do you do, though, if you want to upgrade?
You may not need to actually upgrade, but instead add new .NET-based modules piecemeal.This is probably preferable from a simplicity point of view. This approach has a couple of problems. First problem is that your new ASP.NET programs will not be able to share built-in application or session state information. You will need to find some sort of bespoken workaround or compromise solution.The second problem is the possible performance penalty, but depending on the project, this may or may not be so noticeable.
If you do want to upgrade your Classic ASP projects and applications to run under .NET, then you will need to make quite a few changes to your code.The first change you must make is to rename all .asp files to the new .aspx extension and “Global.asa” to “Global.asax.” The upgrade will be less painful for JScript programmers as very little has
changed (although much has been improved) in the language.VB.NET is broadly similar to VBScript as they share common ancestry, but several important points need to be taken into account:
  • ASP.NET pages support only a single language per page, whereas ASP enabled you to mix and match, provided each language was in its own script blocks.

  • Page functions must be declared in script blocks; they cannot be declared in scriptlet sections.

  • HTML displaying functions are not supported; that is, you cannot have a subroutine that displays HTML using %> <% script style. HTML must be sent to the browser using Response unless outside a function definition. Set and Let assignments are no longer supported. In VB.NET, object assignments are done directly.

  • Nonindexed default properties are not supported in VB.NET; you must address an object’s property values directly.

  • Parentheses are required for calling all methods in VB.NET, whether they are functions or not.

  • If statements must always start a new line after then, whereas with ASP you could just continue straight into the command to execute.

  • ASP.NET pages can use COM and COM+ components. .NET objects can interact with classic ASP scripts as if they are using COM. In order for all projects to see a component, the component must be registered in the Global Assembly Cache, as by default they are only visible to the application they were deployed to.Visual Studio.NET has a wizard for upgrading COM component projects to .NET components that should simplify migrating business logic, and there is an ASP Page Compatibility directive to allow for better compatibility with components that use ASP intrinsic objects.

  • The ASPError object has been removed.

  • By default, Option Explicit is set to true, so you must either declare all variables or set it to false in your script, or within Web.config, to prevent compilation errors.

0 Comments:

Post a Comment

<< Home