migrating asp to asp.net matt gibbs asp.net development manager

35
Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Upload: april-dalton

Post on 17-Jan-2018

232 views

Category:

Documents


0 download

DESCRIPTION

Active Server Pages

TRANSCRIPT

Page 1: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migrating ASP to ASP.NETMatt Gibbs

ASP.NET Development Manager

Page 2: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

• Classic Active Server Pages Background• Why Migrate to ASP.NET?• Migration Strategies• ASP.NET Migration Issues• Tools• Questions

Agenda

Page 3: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Active Server Pages

Page 4: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

• Leading web app development platform– Nearly 1 million developers using ASP today– Many well known applications and sites

• Simple and approachable– No compilers required – “just hit save” – Easy to use languages and object model– Great integration with COM and COM+

• Well established developer support base– Online communities– Books/Consulting/Conferences

Active Server Pages

Page 5: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

How it works….

Page 6: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Internet Information ServerInternet Information Server

10107711

RequestsRequests

66

ResponsesResponses

ISAPI Filters

ISAPI ExtensionsASP.DLL

ASP Script ASP Script EngineEngine

2233

.asp file.asp file

Script ExecutionScript Execution

55

44Script Script CodeCode

99

88Script Script Engine Engine CacheCache

Page 7: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Issues with “Classic” ASP• Way too much code required

– Simple tasks often not easy

• Applications contain spaghetti code– Poor re–use/encapsulation model– Code runs from top of page to bottom

• Late-bound scripting, no strong typing– Different language model in COM though

• Deployment issues– COM and metabase

Page 8: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Sample ASP Page

demo

Page 9: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

How ASP.NET Works

Page 10: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

ASP.NET Http RuntimeASP.NET Http Runtime

Page Page ClassClass

44

88

997711

RequestsRequests

66

ResponsesResponses

33

ASPX ASPX EngineEngine

22

ASP.NETPASP.NETPageage

ModulesModules

Page HandlerPage Handler

55

Class Class InstanceInstance

Page 11: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Sample ASP.NET Page

demo

Page 12: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migrating to ASP.NETBenefits of Migration

• Performance and scalability– Strongly typed code, compiled into binaries– Easily scalable to web farms– Page, partial page, and data caching

• Productivity– Web forms and server controls– Web services– Rich application framework– Great tools and languages support– Supports many mobile browsers

Page 13: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

• Security– Can run under least privilege account– Built-in forms based authentication– Custom security infrastructure

• Reliability– Application isolation, recycling, health detection– Benefits of managed code

• Manageability– XCOPY deployment– Easily configurable (web.config)

Migrating to ASP.NETBenefits of Migration

Page 14: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

• Migration will always require work– No magical migration tool– Trivial pages may be easy– Applications will be more difficult

• Reality is:– Can’t simply change file extensions– Incompatibilities in language, framework, environment

Migrating to ASP.NETThe Bad News

Page 15: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

• Developer’s ASP skills will migrate– Natural migration from VBScript to VB– ASP intrinsic objects pulled forward– Inline coding still possible

• Can leverage existing assets– Existing pages can be converted– Existing components still work (through interop)– Migration can be incremental

Migrating to ASP.NETThe Good News

Page 16: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migration Strategies

Page 17: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migration Strategies• Vertical Migration

– Use both ASP and ASP.NET– Migrate individual features

• Horizontal Migration– Move .asp files to .aspx– Go for functional equivalence

• Re-write / New Application– Move completely to ASP.NET– Take advantage of new features

Page 18: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migration StrategiesVertical Migration

• ASP and ASP.NET pages run side by side– Separately installed and configured

• Use ASP.NET without breaking ASP– Migrate or add selected functionality– Useful for new, isolated features– Gain immediate perf benefits

• Limited interoperability– ASP pages can’t use ASP.NET features– Run in separate worker processes– No sharing of state

Page 19: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migration StrategiesHorizontal Migration

• Rename .asp to .aspx, and correct problems– Correct page syntax– Translate VBScript to Visual Basic .NET

• Take advantage of key ASP.NET features– Can call Framework code– Page compilation– Scalable session state, caching

• Not a full port yet– No improvements in code manageability– COM interop work may be needed

Page 20: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migration StrategiesFull Rewrite

• Complete rewrite of pages and components– Use ASP.NET server controls– Rewrite business components using Framework

• Take full advantage of ASP.NET– True code separation, encapsulation– Page framework and controls– ASP.NET Security

Page 21: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Migration StrategiesGuidelines Summary

• Use vertical migration for– Well partitioned applications– New functionality in existing apps

• Use horizontal migration for– Heavy use of application or session state– Complex, unfactorable tiers

• Use rewrite for– Re-architecture of system– Significant new functionality

Page 22: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

ASP.NET Migration Issues

Page 23: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Semantic ChangesProgramming Language

• Single choice of server language– Cannot mix languages on page– Client script not affected

• VBScript Visual Basic .NET– All variables have a specific type– No more default properties (big change)– No “Set” and “Let” syntax– Parentheses required for calling subroutines– Arguments now ByVal by default

Page 24: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Code Changes• Page functions

– Must be in <script runat=server> blocks• Page “render functions”

– Not supported, must use Response.Write• Variable references

– Cannot reference variables in other <% %> blocks

• Page directives (@Option, @Session, etc.) no longer supported– Merged into single Page directive

Page 25: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Server ComponentsOptions for Using COM Objects

• Simple Usage– Call Server.CreateObject(“progid”) and access it

as a late-bound object

• Create .NET wrapper classes– Provides early binding – Optimizes performance of calls– TLBIMP.exe utility

• Rewrite using .NET

Page 26: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Server ComponentsUsing ASP Intrinsics in components

• Support for ASP intrinsics– ObjectContext intrinsic Flow– Application OnStart and OnEnd

• ASPCompat mode– <%@ page aspcompat=true %> – Enables access to intrinsic objects

Page 27: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

ASP.NET Migration Examples

demo

Page 28: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Server ComponentsPerformance Considerations

• Marshalling costs– Calls between ASP.NET and COM– Performance benefits by rewriting COM in .NET

• ASP.NET Thread Pool now MTA -- not STA– What is an MTA? What is an STA?– Impacts performance of apartment components – VB5 and VB6: Apartment Components

• Can enable STA Thread Pool on a per-page basis– Address perf. of existing VB components– <%@ Page ASPCompat=“true” %>– Not necessary for C++ MTA components

Page 29: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Security Changes• ASP: Use Windows (IIS) authentication

– NTLM (default), Basic, Digest, or Kerberos– Impersonate caller by default– Forms based auth: roll your own– ACL based URL authorization

• ASP.NET: Customizable authentication– Windows (default), Forms, or Passport – Impersonation must be enabled– Built-in forms authentication– Role based declarative authorization

Page 30: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Configuration Changes• ASP: Configuration

– Binary data store used by IIS (metabase)– Used by Classic ASP– Changes required local server access

• ASP.NET: XML Configuration– Machine.config, web.config– Most IIS settings do not affect ASP.NET– Changes do not require local server access

Page 31: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Tools

Page 32: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

ASP.NET Migration Assistant

• Features– Corrects ASP.NET page syntax– Translates VBScript into Visual Basic .NET

• Visual Studio or command line translation • Starting point for further migration• Available from:

– http://www.asp.net/migrationassistants/

Page 33: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

ASP.NET Migration Assistant

demo

Page 34: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager

Summary• Migration not seamless

– Will involve some work– Can be done incrementally

• Worth the efforts– Better performance– Easier development– Cleaner and more manageable code– Platform to build apps for the future

Page 35: Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager