1 / 24

Migrating Existing ASP Applications to ASP.NET

Migrating Existing ASP Applications to ASP.NET. An in-depth look at the paradigm shifts and upgrade strategies when moving from ASP to ASP.NET architectures. By Carl Prothman Microsoft “Most Valuable Professional” (MVP) “Certified Computer Professional” (CCP). Introductions. Carl Prothman

vienna
Download Presentation

Migrating Existing ASP Applications to ASP.NET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Migrating Existing ASP Applications to ASP.NET An in-depth look at the paradigm shiftsand upgrade strategies when moving from ASP to ASP.NET architectures. By Carl Prothman Microsoft “Most Valuable Professional” (MVP) “Certified Computer Professional” (CCP)

  2. Introductions • Carl Prothman • Microsoft “Most Valuable Professional” (MVP) • Visual Basic MVP 1998/2002 • ASP.NET MVP 2002/2003 • Certified Computer Professional(CCP) • Microsoft Certified Professional (MCP) • Over 22 years of experience in Software Industry • Bachelor of Science inAeronautics and Astronautics(BSAA) from University of Washington • Email:carlpr@spamcop.net • Able Consulting, Inc. • Owner http://www.able-consulting.com

  3. Agenda • .NET Overview 1 min • What is it? • Paradigm Shifts 35 mins • Top 10 (make that 11) • Migration Strategies 15 mins • Side-by-Side Conversion • Tier-by-Tier • Summary 9 mins • Q&A Total: 60 mins

  4. Overview • What is Microsoft’s .NET? • Set of Microsoft software technologies connecting your world of information, people, systems, and devices • Enables an unprecedented level of software integration through the use of XML Web services: • Small, discrete, building-block applications • Connected to each other via the Internet • What is ASP.NET? • The development platform for building server-based Web applications • Web Forms and XML Web Services • HTTP Runtime Architecture with IIS

  5. ASP.NET– Overall View

  6. Agenda • .NET Overview • Paradigm Shifts 25 mins • Migration Strategies • Summary

  7. ASP.NET Paradigm Shifts • What is a Paradigm Shift? • A set of concepts, values, practices and assumptions that constitutes a way of viewing reality for the community that shares them. • When one paradigm looses influence and another paradigm takes over, then there is a paradigm shift! • Knowing in advance how a Paradigm Shift might occur gives you an advantage over others!

  8. ASP.NET - Paradigm Shift0) Remote Application Communication • In ASP, you used the RDS DataSpace to communicate to a remote COM+ Component over DCOM or HTTP(S) • RDS is a major security hole! • RDS DataFactory MS99-025 • RDS Data Stub MS02-065 • In ASP.NET, you now use an XML Web Services to communication to remote applications • Standard protocol (SOAP) for distributed environments • Over HTTP with XML SOAP Envelop / Payload

  9. ASP.NET - Paradigm Shift1) Server-Side Web Controls • In ASP, you used Response.Write or <%= % to send HTML / script to the Web browser • In ASP.NET, you can now program against server-side Web Controls which generate the HTML • HTML Server Controls • HTML Tag with and ID= and RunAt=Server attributes • Web Server Controls • ASP.NET control with ID= and RunAt=Server attributes • Form Validation Controls • Client-side and Server-side Validation • User Control Page (.ASCX) • Replaces the HTML Include command • Custom Control Assembly (.DLL)

  10. ASP.NET - Paradigm Shift2) Automatic HTML Code Generation • In ASP, you created custom pages for each browser type • Use browscap.ini file with the BrowserType object • In ASP.NET, you use server-side Web Controls and Web Forms to generate the HTML • ASP.NET figure out the browser type • Automatically renders the correct, browser-compliant HTML for features such as Styles, Layout, and so on. • In Visual Studio .NET, set TargetSchema Property on the Page • Internet Explorer 3.02 / Navigator 3.0 • Internet Explorer 5.0 • Navigator 4.0

  11. Paradigm Shift3) Automatic Web Control State • In ASP, you had to fill the control with user entered values on POST back • Show the web page again with an error message • In ASP.NET, the controls automatically retain the user entered values on POST back • ViewState is used to store Control State • User selection, Control Info… • Control values are automatically filled in for you during post back. • Can store values in ViewState between round trips • Must only use one FORM on page • Must post to the same page for ViewState to work!

  12. Paradigm Shift4) HTML Separate from Code • In ASP, you could mix HTML with client-side and server-side script • Hard to read and maintain • Some used “.vbs” or “.js” files to separate out the script • In ASP.NET, you can either • Put the code in-line with SCRIPT tags • Or put code in a “code-behind” page • Visual Studio .NET creates code-behind pages by default • ASP.NET Web Matrix creates in-line SCRIPT tags by default

  13. Paradigm Shift5) Compiled ASP.NET Code • In ASP, you used server-side VBScript (or JavaScript) which was interpreted, hence slower! • So most folks just pulled the server-side script out and put it into a VB 6.0 / C++ COM+ Components (N-Tier) • Presentation Tier Classes • Business Tier Classes • Data Tier Classes • In ASP.NET, everything is compiled, which is faster! • In-line SCRIPT tags with RunAt=Server • Code Behind page (must compile) • Debug –vs- Release mode

  14. Paradigm Shift6) Registering Client-Side Script • In ASP, you could directly add client-side event handlers to HTML controls • In ASP.NET, you add client-side event handlers to Web Controls via Attribute.Add • Button1.Attributes.Add(“onclick”, “alert(‘Hello’)”) • You can also register a client script block • RegisterClientScriptBlock • Client-side JavaScript / JScript • VBScript

  15. Paradigm Shift7) User Controls Instead of Includes • In ASP, you used includes files to include common script code • In ASP.NET, you now use User Controls (ASCX) for common code • Headers, Footers, etc.. • Public Properties and Methods • Inheritance from BaseControl • Reuse common Properties, Methods, and settings

  16. Paradigm Shift8) XML Configuration Files • In ASP, you used System Registry (or IIS Metadata db) to store Application settings • In ASP.NET, you use XML files to store Application settings • Machine.config (for all projects on the machine) C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG\machine.config • Web.config (for each project) • Read in configuration settings using System.Resources.ConfigurationSettings.AppSettings[“myKeyName"]

  17. Paradigm Shift9) ASP.NET Worker Process • In ASP, IIS used the ASP.DLL to handle each web request • In ASP.NET, IIS calls an ASPNET worker process (aspnet_wp.exe) • Identity of ASP.NET Worker process controlled by • machine.config, processModel element, userName attribute C:\WINNT\Microsoft.NET\Framework\v1.0.3705\CONFIG\machine.config • "MACHINE": runs as low privilege user account named "ASPNET". • "SYSTEM": runs as localsystem (high privilege admin) account. • Running IISRESET stops the Worker process

  18. Paradigm Shift10) Windows Impersonation • In ASP, impersonation was enabled by default • Using Anon Access, ASP would impersonate IUSR_XXXX • Using NTLM / Basic, ASP would impersonate calling User • In ASP.NET, impersonation is disabled by default • You must explicitly enable impersonation in web.config or machine .config file <authentication mode="Windows" /> <identity impersonate="true" /> System.Security.Principal.WindowsIdentity.GetCurrent().Name • CARLP7\ASPNET (ASP.NET User account) • CARLP7\IUSR_CARLP7 (IIS Anon User account) • CARLP7\Administrator (User account that I’m logged as)

  19. Agenda • .NET Overview • Paradigm Shifts • Migration Strategies 20 mins • Summary

  20. Migration Strategies Side-by-Side • ASP and ASP.NET Side-by-Side • Both ASP and ASP.NET files can run side-by-side in same IIS Web Application • However, you cannot share Session variables between them directly • Steps to “convert” ASP to ASP.NET • Rename the ASP file to use the “.ASPX” file extension • Browse to the page and update server-side code as needed • Option Explicit is the default. Remove Option Explicit line. • Method calls with parameters require “(“ and “)”. • Don’t need Set or Let anymore. Remove them. • For ADO/COM objects, use “aspcompat=true” in the Page directive • “&” must have spaces around it. No more s = str1&str2 • No more Default Properties. Must state explicitly: oRs(0).Value • No more VBScript Variants => Objects / .NET Framework Class Library • ByValue is now the default. Was ByRef in VB 6.0. • VB.NET is now 0 based. Was 1 based (in some cases) in VB 6.0 • Integer data type is now 32 bits. Was 16 bit in VB 6.0 • …

  21. Migration Strategies- Tier by Tier • First Convert the UI Tier • Create new WebForms / User Controls • Call existing COM Components • Next Convert the Business Tier • Create Class Modules for each Business class • If Internet clients need to reuse these new classes, create XML Web Services wrappers • Finally Convert Any Desktop Database • Upgrade your old Access MDB to MSDE or SQL Server

  22. Agenda • .NET Overview • Paradigm Shifts • Migration Strategies • Summary 5 mins

  23. Summary • Reviewed ASP.NET Paradigm Shifts • Top 10 (make that 11) • But there are a lot more… • Reviewed Migration Strategies • Side by Side Conversion • Tier by Tier Conversion • Better understanding of ASP to ASP.NET Migration Issues

  24. Questions? • Q & A • More Information • ASP.NET Web Site http://www.asp.net • GotDotNet Web Site http://www.gotdotnet.com • These slides / sample code are at: • http://www.able-consulting.com/

More Related