1 / 39

An Introduction to ASP .NET

An Introduction to ASP .NET. Chris Whitehead, MCSE Columbus State University. Microsoft’s Claim.

jerold
Download Presentation

An Introduction 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. An Introduction toASP .NET Chris Whitehead, MCSE Columbus State University

  2. Microsoft’s Claim ASP.NET is a revolutionary programming framework that enables the rapid development of powerful web applications and services. Part of the emerging Microsoft .NET Platform, it provides the easiest and most scalable way to build, deploy and run distributed web applications that can target any browser or device.

  3. ASP • Simple procedural programming model • Access to COM Objects • ADO • File system object • No compiling, just save • Support for Multiple Scripting languages • Mix HTML and Code • VBScript – Leverage VB Skills

  4. Advantages of Using ASP • Dynamic creation of Web pages • Easy connection and display of database information • Can perform form processing • Browser-independent • Can be tested on local machine • PWS – 95/98/ME • IIS – 2000/XP • Flexible server-side scripting capabilities • VBScript, JavaScript, CGI/Perl • C, C++, C#, Java • Pages can include both server-side scripting and client-side scripting

  5. ASP Challenges • Code Readability • Mixed code + html • Performance • Interpreted • PostBack Complexity • Had to manage postback manually • Reuse • DLL Locking • Permission Denied (Error 70) • Deployment • Sessions • Restricted To Inproc • Caching • Different Programming models, debuggers, IDE’s etc

  6. Why ASP .NET? Solve the issues inherent in ASP • Enhanced performance • Power and flexibility • Simplicity • Manageability • Scalability and availability • Customizability and extensibility • Reliability • Security

  7. Why ASP .NET? (2) • Make it easier to build web apps • Make it easier to deploy web apps • Make it easier to operate web apps • Provide greater performance,reliability, and scalability

  8. What is ASP .NET • Not an ASP upgrade • Next-generation, unified Web development framework • New control-based, execution model for Web UI

  9. ASP .NET Capabilities • It’s really, really fast! • Deploy and upgrade running apps with XCOPY • Great tools support • Automatically detects and recovers from errors • Web farm scalable session state • Built-in output caching • Supports wide range of mobile devices • Uses compiled languages • Makes building web services easy • Much simpler page development model

  10. Changes from Previous Versions • Requires .NET framework • Pages end in “.aspx” instead of “.asp” • Can process both “.asp” and “.aspx” • Expanded object library • Web services and server controls

  11. 2781 1989 1154 Microsoft ASP.NET PC Magazine Nile Application Test Pages Served per Second 2800 8 CPU 4 CPU 2 CPU 2400 2000 1600 1200 748 637 800 330 400 Microsoft ASP

  12. Developer Productivity

  13. System Requirements • Requires a ASP processor on the server • For previous versions of ASP • Windows 95/98/ME/NT/2000/XP • Preinstalled with PWS or IIS • Linux – add-in • For ASP .NET • Windows 2000+ • IIS 5.0+ • .NET Framework

  14. Installation • Server • Download and install .NET Framework (http://www.asp.net/download.aspx) • Add ASPNET user

  15. ASP .NET Configuration • Stored in XML file in directory with pages • web.config • Contains all ASP.NET settings • Authentication, compile options, custom error pages, etc. • Allows adding Application settings • DSN, URLs to WebServices, etc • Extensible • Can extend with custom configuration data

  16. The .NET Framework VB C++ C# JScript … Visual Studio.NET Common Language Specification WindowsForms ASP.NET: Web Services and Web Forms WindowsForms ADO.NET: Data and XML Base Class Library Common Language Runtime

  17. Web Forms • A Web Form combines declarative tags (HTML, ASP directives, server controls and static text) with code • However, good separation provided between code and tags separate files single file <tags> <tags> code code Form1.aspx Form1.aspx Form1.vb

  18. Web Forms (2) • 45 Built In Controls • Target any HTML 3.2 browser • Raise Events to Server • Basic Controls • textbox, checkbox, radio, button • Advanced Controls • AdRotator, Calendar, DataGrid, Validator

  19. ASP Architecture ASP .ASP Request for Page

  20. ASP .NET Architecture ASPX .ASPX Request for Page

  21. ASP .NET Architecture (2) Compiled .ASPX First Request for Page

  22. Compiled .ASPX ASP .NET Architecture (3) Subsequent Request for Page

  23. Compiled .ASPX ASP .NET Architecture (4) Page is modified

  24. ASP .NET Syntax • Requires “<%” and “%>” enclose any ASP scripting • Scripting can be placed in any location in a Web page provided it is enclosed in the delimiters

  25. Hello World Example <html> <head> <title>Hello World</title> <body> <% response.write (“Hello World!”) %> </body> </html> Save as helloworld.aspx

  26. Server Controls • Used in addition to or instead of <% %> to control Web page • Use runat=“server” attribute

  27. More on Server Controls • Previous form <form action = “process.asp”> <input type = “text” name = “mytextbox”> </form> • With server controls <form action = “process.aspx” method-post runat = “server”> <asp:textbox id = “MyTextBox” runat = “server” /> </form>

  28. Data Controls • Bind to many data sources • Collections • Array • HashTable • Dictionary • ADO.NET • DataReader • DataSet • XML • Can bind data to virtually any control • Eg textbox, listbox + more specific data-orientated controls (eg datagrid)

  29. DataSet DataGrid Authors Publishers Repeater DataList DataView/DataSet Data Controls “Data Controls”

  30. ASP.NET Web Applications • Global ASAX • Application Variables • Session State • Web Configuration • i.e properties of the web site msdn.microsoft.com

  31. Web ApplicationsGlobal.ASAX • First Request • Application_Start • First Request for Each User • Session_Start • Each Request • Application_BeginRequest • Application_Authenticate • Application_EndRequest • Application Error • Application_Error • User Logs Out/Session Times Out • Session_End • Web Server Shutdown • Application_End msdn.microsoft.com

  32. ASP .NET Web ApplicationsConfig.Web • Site Configuration file • Like an .INI file for your site • XML format • Extensible • Some settings • Security • Session • Localization • Tracing • Debugging msdn.microsoft.com

  33. ASP .NET Web ApplicationsSession Variables • Store state information • No longer require Cookies • Share between servers <sessionstate inproc="false" server=“AnotherServer" port="42424" /> msdn.microsoft.com

  34. Caching • Output caching • Serves rendered result of a page from cache • Big performance win: cached pages are as fast as static pages • Vary by params, language, user-agent • Cache API • Enables arbitrary objects to be cached • Example: result of database query • Can be a big performance win

  35. Improved Deployment • Components can be dynamically updated • No more locked DLLs • Just copy new DLL on top of old one • No tools, no configuration changes, no app shutdown, no re-boots • Works great with content replication systems

  36. Improved Reliability • ASP.NET has been designed with assumption that failures will occur on systems • Designing for failure reduced fragility • Detects/recovers from common problems • Access Violations, Memory Leaks, Deadlocks • Pre-emptive cycling of applications • Time and Request Based Settings • Net Result: Users should never think that an ASP.NET application is down or unavailable

  37. Migrating From ASP • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnetmigrissues.asp • Guidelines for existing ASP Solutions • Use Option Explicit • Avoid Using Default Properties • Use Parentheses and the Call Keyword • Avoid Nested Include Files • Organize Utility Functions into Single Files • Remove Code from Content as much as Possible • Do Not Declare Functions Inside <% %> Blocks • Avoid Render Functions • Explicitly Free Resources (Call Close Methods) • Avoid Mixing Languages msdn.microsoft.com

  38. ASP .NET Resources • 123aspx.com • ASPFree.com • ASPNG.com • ASP Today • ASPAlliance • 4GuysFromRolla.com • ASPWorkshops.com • 411ASP.NET • ASPX101.net • ASP.net • MSDN.Microsoft.com

  39. Summary • ASP.NET is a rich web application platform • Combines simplicity and power • Easy to deploy and maintain • Reliable, highly available and scalable • It’s really, really fast!

More Related