Moving from ASP to ASP.NET

Slides:



Advertisements
Similar presentations
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
Advertisements

11 ASP.NET Slides based off:. 22 B ACKGROUND - W EB A RCHITECTURE Web Server PC/Mac/Unix/... + Browser Client Server Request:
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 1.1 of…
Introduction to ASP.NET What is.NET What is ASP.NET and how is different from ASP –ASP: server side technology for creating dynamic web pages using scripting.
Kashif Jalal CA-240 (072) Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 2 of…
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Inline, Internal, and External FIle
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
© 2004 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin Programming the Web Using ASP.Net Chapter 2: The ASP.Net Template Dave.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
1 Presented by Bikash Shrestha. 2 What is ASP.NET or ASP+? ASP.NET/ASP+ is a programming framework built on the common language runtime that can be used.
ASP.NET Dr. Ralph Westfall May, Web Development Problem HTML designed to display static pages only interactive when user clicks links  can’t provide.
ASP.NET INTRODUCTION INTO وزارة التربية و التعليم العالي كلية العلوم و التكنولوجيا قسم علوم الحاسوب و تكنولوجيا المعلومات اعداد الاستاذ: عبد الله محمد.
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
ASP.NET  ASP.NET is a web development platform, which provides a programming model, a comprehensive software infrastructure and various services required.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Introduction to ASP.NET 1www.tech.findforinfo.com.
ASP.NET application. Roadmap ASP.NET file types Bin directory Application updates Simple application from start to finish using a virtual directory Behind.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
ASP.NET OPTIMIZATION. Why Optimize? $$$ Whether you build applications for customers or not, enhanced applications save money.
From DNA to.NET Design Path. Objectives Sketch up a typical Win DNA Application Sketch up the.NET version Compare Design and Implementation Advantages.
Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages.
Module 1: Working with ASP.NET. Overview Introducing ASP.NET Creating Web Forms Adding ASP.NET Code to a Page Handling Page Events Discussion: ASP vs.
Christopher M. Pascucci.NET Programming CodeBehind.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Module 4: Creating a Web Application with Web Forms
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Introduction to ASP.NET What is ASP.NET and how is different from ASP –ASP: server side technology for creating dynamic web pages using scripting languages.
ASP. NET Differences Dave Webster EMEA Technical Team dave
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager.
Introduction to ASP.NET What is.NET What is ASP.NET and how is different from ASP –ASP: server side technology for creating dynamic web pages using scripting.
CIS 375—Web App Dev II ASP.NET 1 Getting Started.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
7-1 Active Server and ADO Colorado Technical University IT420 Tim Peterson.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
A Detailed Introduction To Visual Studio.NET CRB Tech ReviewsCRB Tech Reviews introduces you to the world of Visual.
Lecture 6 Sara Almudauh ASP.NET Part 1 Development of Internet Application 1501CT - Sara Almudauh.
CS122B: Projects in Databases and Web Applications Spring 2017
CS122B: Projects in Databases and Web Applications Winter 2017
Session Variables and Post Back
Introduction to Client-Server Programming
Florida Gulf Coast University
Haritha Dasari Josue Balandrano Coronel -
Using Procedures and Exception Handling
Unit# 8: Introduction to Computer Programming
Chapter 23 – ASP.NET Outline 23.1 Introduction NET Overview
Web Development in Microsoft Visual Studio 2013
JavaScript Introduction
Web Development Using ASP .NET
CS122B: Projects in Databases and Web Applications Winter 2018
CS122B: Projects in Databases and Web Applications Spring 2018
Module 10: Creating a Web Application with Web Forms
ASP.NET Module Subtitle.
Introducing the .NET Framework
Web Development Using ASP .NET
An Introduction to JavaScript
ASP.NET Imran Rashid CTO at ManiWeber Technologies.
Presentation transcript:

Moving from ASP to ASP.NET

Contents Overview Migration Issues – Good and Bad Structural Differences Page Layout, Languages, Syntax etc. VBScript and VB.NET COM Compatibility Migration Approach Summary

Overview Completely re-designed ASP Model Maintains compatibility wherever possible Breaks compatibility in favor of improved performance Clear separation of Logic from presentation 10x more Features than traditional ASP Re-designed ASP Model – Structured and Object-oriented Gave up backward compatibility in favor of improved performance and better platform which can grow for a long period of time While ASP.NET preserves the majority of ASP's feature set, 100% compatibility between the two was not possible if the platform was to move forward, so there are a few changes to the old way of doing things.

Advantages of ASP.NET Improved Performance and Scalability Extensive list of server side Page Controls Web Farm support Output Caching and Security Options XML Web Service Infrastructure Configuration and Deployment

Migration : Bad News Can’t insert .NET info into existing HTML pages Migrating existing pages from ASP to ASP.NET requires extensive rework Can’t use VBScript ASP and ASP.NET pages can’t share State Management, without effort ASP Model has been completely re-designed. So most pages will require some changes before they can run under ASP.Net ASP and ASP.NET can co-exist but can’t share Session state and Application state

Migration: Good News Preserves Developer’s ASP Skills Improved Performance of compiled code Increased Developer’s productivity ASP and ASP.NET pages can co-exist New file extension .aspx Many more built in objects Many things are possible in .NET that were impossible or difficult before If you have worked with ASP before, ASP.NET programming paradigm will seems familiar to you. No changes to ASP.dll New features like server controls and event handling in ASP.NET help developers build applications more rapidly and in fewer lines of code. It is also easier than ever to separate code from HTML content.

Structural Changes: Layout Scripting Blocks Use <script runat=server /> instead of <%...%> to declare variables and functions Variables declared within <%...%> are accessible to other render blocks only, not to other functions Multiple <script> blocks but same language within the Page <%....%> refer these tags as code-rendered blocks

Replace Functions like <% Sub DoSomething() Response.Write "Hello World!" End Sub DoSomething %> With <script language="VB" runat=server> Sub DoSomething() Response.Write ("Hello World!") </script> <% DoSomething() %> Note parentheses around Write method.

Page_Load Any initialization code which needs to run as soon as page is loaded should be included in the Page_Load event Any code inside <%..%> will be executed when page is rendered – similar to ASP A related Page_Unload is always the last event to be raised during the life-cycle of a page With traditional ASP, code was enclosed within <%…%> tags and page processing began with the first statement following the first <% tag. You can still write code in <%…%> blocks, but it will be executed at render time (in top-down fashion, as in ASP) after the page is loaded.

Render Functions In ASP, page-render functions could be declared with <%...%> blocks: <% Sub RenderFunction() %> <font color="red">Time: <%=Now %> </font> <% End Sub %> <% RenderFunction %> In ASP.NET replace above code with: <script language="VB" runat=server> Sub RenderFunction() Response.Write ("<font color=red> ") Response.Write (“Time: " & Now) End Sub</script> <% RenderFunction() %> Using older versions of ASP, you could insert literal HTML within a procedure body Unlike Active Server Pages (ASP), it is invalid to declare a function or sub routine within a code render block (between <% and %> tags) in ASP.NET.

Page Directives In ASP, a single directive could be placed on the first line, for example: <%@LANGUAGE="VBScript" Debug=“true” %> In ASP.NET, several new directives have been added, Language attribute should be placed within Page directive: <%@Page Language="VB" Debug=“true” %> But for migration purposes, the shorter ASP-style syntax is also supported for the Page directive only Case and quotes are not important.

Language Changes Supports all CLR-compatible languages including VB.NET , C# and JScript.NET Declare default language at the top of the page : <%@Page Language=“c#” %> Only one language per page but can have controls written in different languages Different languages are allowed within the same application

API Changes Fully API-compatible with traditional ASP except for the following: Request(), Request.QueryString() and Request.Form() Traditional ASP returns an array of strings http://localhost/test/Test.aspx?values=45&values=600 <% ‘ Below line outputs: “45, 600” Response.Write Request.QueryString(“values”) ‘ Below line outputs: “45” Response.Write Request.QueryString(“values”)(0) %>

In ASP.NET these collections require an explicit method to access Query String values These are 0 based collections http://localhost/test/Test.aspx?values=45&values=600 <% ‘ Below line outputs: “45, 600” Response.Write(Request.QueryString(“values”)) ‘ Below line outputs: “45” Response.Write(Request.QueryString.GetValues(“values”)(0)) %>

VBScript and VB.NET Migrating VBScript to VB.NET would be the most challenging issue Major Issues No more default properties No more Let and Set Parentheses required for calling Subs and passing parameters Arguments ByVal by default Array Elements start with 0 Property syntax is different IsNull is now IsDBNull for DB

COM Component Compatibility Most COM components should work fine Use Server.CreateObject(progID) for late binding When using single-threaded (STA) COM components, such as components developed using VB, you must include the compatibility attribute aspcompat=true in the Page directive on the ASP.NET page. E.g. <%@Page aspcompat=true Language = VB %> Changes in ASP.NET security model will cause COMException if existing MTS components are used. add a new Local Machine a/c under Default Access Permissions While late binding to components is still supported, early binding is a better choice for performance reasons. Once the COM component is converted to a .NET assembly, you can import it into an ASP.NET page by placing aspcompat directive at the top of the page.

COM: Performance Considerations ASP.NET thread pool is MTA VB5 and VB6 produced STA components Use early binding to increase performance Use TlbImp tool to convert COM components to equivalent .NET Assembly Calls between managed and unmanaged code has marshalling cost Consider re-writing COM components to .NET Assemblies You can also use early-bound, traditional COM components by creating runtime callable wrappers (RCWs), which optimize the performance of calls between unmanaged and managed code. If you convert the STA component to an assembly using TlbImp, the runtime does not detect that the component uses the STA model and does not throw an exception, but your application can suffer from poor performance and possible deadlocks. STA components cannot be used from .NET Framework code modules (compiled .NET assemblies); they can be used only from ASP.NET pages.

ADO Compatibility ADO.NET is evolutionary improvement to ADO – Totally new set of classes Changes are not required to make ADO to work under ASP.NET Add aspcompat attribute to the Page Most changes will be language related ADO will work under ASP.NET but there are significant advantages to migrate to ADO.NET

Steps to convert ASP or HTML Pages to Web Form using VS.NET Add existing ASP or HTML page to the solution and rename the extension to aspx Allow VS.NET to create code-behind page Page directive at the top of the page It also corrects certain HTML syntax Convert existing inline ASP code <%..%> to a class file Convert Client-side script (VBScript or JScript) to Web-Forms ASP.NET code Client script will run without modification in Web Forms pages, since it runs entirely in the browser. However, you might want to re-implement the same functionality in Web Forms server code instead so that there are no browser dependencies in the page.

Optionally convert HTML elements to Web or HTML Server controls Convert Visual InterDev design-time controls (DTCs) to Web Forms controls. Optionally convert HTML elements to Web or HTML Server controls Controls you need to access from the server Other HTML controls will work just fine Optionally convert ADO code to ADO.NET Save the form, compile the project, and view the page in the browser. Look for issues in the Task List and Resolve them When the migration is complete, you can run the page normally. Generally, however, after performing the migration you will want to do further work on the page, such as substituting ASP.NET server controls for existing HTML elements. You should plan for having minimum number of Server controls.

Migration Approach Staged Migration of existing application Does not have to be nothing or all Page-by-Page migration Identify complexity presented by existing ASP implementation ASP.NET provides many advanced features Streamlines web-programming model Start with poor performing parts of the application Pages that are changing significantly New Functionality

Other Recommendations Don’t forget about Server side code when migrating ASP Pages Careful about State Management between ASP and ASP.NET Pages Duplicate Global.asa global variables in Global.asax Centralized Session storage Use Query String/Hidden Variables and Cookies

Summary ASP Applications will not seamlessly upgrade to ASP.NET Will involve some work to port Will continue to work side-by-side Benefits of upgrading to ASP.NET Better performance Easier development Cleaner code Platform to build apps for the future