1 / 20

Introduction to ASP.NET

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 languages eg vb script.

kylia
Télécharger la présentation

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. 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 languages eg vb script. • ASP.NET: server side technology for creating dynamic web pages using Fully Fledged programming languages supported by .NET • VB.NET: our chosen language for writing ASP.NET pages

  2. What is .NET? • A Microsoft strategy and new technology for delivering software services to the desktop and to the web • Components include: • MS Intermediate Language; all code is complied into a more abstract, trimmed version before execution. All .NET languages are compiled to MSIL – the common language of .NET • The CLR- common language runtime; responsible for executing MSIL code; interfaces to Windows and IIS • A rich set of libraries (Framework Class Libraries) available to all .NET languages • The .NET languages such as C#, VB.NET etc that conform to CLR • ASP.NET is how the Framework is exposed to the web, using IIS to manage simple pages of code so that they can be complied into full .NET programs. These generate HTML for the browser. • Built on open protocols (XML, SOAP) • Future for development of MS & non-MS based systems. • Also heading towards the “Internet Operating System”

  3. Common Language Runtime Type System Compilers use the runtime type system to produce type compatiblecomponents Components C# VB C++ Compilers Runtime Environment Common Type System

  4. Robust And Secure • Native code compilation • MSIL • No interpreter • Install-time or run-time IL to native compilation • Code correctness and type-safety • IL can be verified to guarantee type-safety • No unsafe casts, no uninitialized variables, no out-of-bounds array indexing • Evidence-based security • Policy grants permissions based on evidence (signatures, origin)

  5. .NET Execution Model VB VC ... Script NativeCode IL Common Language Runtime Standard JITCompiler NativeCode

  6. Common Language Runtime • Lightweight Just-in-time compiler: • MSIL to Native machine language • Can be ported to numerous platforms • Free/Net BSD UNIX port has been announced • “MONO” Open source movement

  7. Framework Overview VB C++ C# JScript … Visual Studio.NET Common Language Specification Web Forms (ASP.NET) Win Forms Data and XML Base Class Library Common Language Runtime

  8. .NET Framework Architecture System.WinForms System.Web Controls Drawing Web Services Web Forms Windows Application Services ASP.NET Application Services System Base Framework ADO.NET XML SQL Threading IO Net Security ServiceProcess Common Language Runtime Type System Metadata Execution

  9. ASP.NET • ASP.NET provides a means of exposing the .NET Framework and its functionality to the WWW • Contains a number of pre-built types that take input from .NET types and represents them in a form for the web (such as HTML) • Class browser: http://interdev.csse.monash.edu.au/quickstart/aspplus/samples/classbrowser/vb/classbrowser.aspx

  10. Web Services • Web Services also provide a means to expose .NET functionality on the web but Web Services expose functionality via XML and SOAP (cf: function calls over the web)

  11. How ASP.NET works • When .NET is installed, IIS is configured to look for files with the .aspx extension and to use the ASP.NET module (aspnet_isapi.dll) to handle them. • ASP.NET parses the .aspx file and arranges it in a predefined class definition and generates an asp.net page object. • The page object generates html that is sent back to IIS and then the browser. • NOTE: only .aspx files are parsed (if it is pure html don’t save it as an aspx file as it will slow down the server.

  12. ASP.NET samples • Page directives: <%@ page language = “VB” debug="true" trace="true“ %> • <script language = “VB” runat=“server”> VB.NET code declarations ……….. </script> • Message.aspx <html> <head> <title>Inserting ASP.NET code Example</title> </head> <body> Line1: First HTML Line<br /> Line2: Second HTML Line<br /> Line3: Third HTML Line<br /> </body> </html> • Note this has no asp code so better to use .html extension

  13. Message2.aspx <script language="VB" runat="server"> Sub Page_Load() Response.Write ("First ASP.NET Line<br />") Response.Write ("Second ASP.NET Line<br />") Response.Write ("Third ASP.NET Line<br />") End Sub </script> <html> <head> <title>Inserting ASP.NET code Example</TITLE> </head> <body> Line1: First HTML Line<br /> Line2: Second HTML Line<br /> Line3: Third HTML Line<br /> </body> </html>

  14. Message3.aspx html> <head><title>Inserting ASP.NET code Example</title></head> <body> Line1: First HTML Line<br /> Line2: Second HTML Line<br /> Line3: Third HTML Line<br /> <script language="VB" runat="server"> Sub Page_Load() Response.Write ("First ASP.NET Line<br />") Response.Write ("Second ASP.NET Line<br />") Response.Write ("Third ASP.NET Line<br />") End Sub </script> </body> </html>

  15. Render or inline code block –interweave1.aspx <html> <head> <title>Interweaving ASP.NET code and HTML Example</title> </head> <body> Line1: First HTML Line<br /> <% Response.Write ("First ASP.NET Line<br />") %> Line2: Second HTML Line<br /> <% Response.Write ("Second ASP.NET Line<br />") %> Line3: Third HTML Line<br /> <% Response.Write ("Third ASP.NET Line<br />") %> </body> </html> NOT RECOMMENDED.

  16. Interweave2.aspx A Server control script language="VB" runat="server"> Sub Page_Load() Message.Text="The ASP.NET line" End Sub </script> <html> <head> <title>Inserting ASP.NET code Example</TITLE> </head> <body> First HTML Line<br/> <asp:label id=Message runat="server"/> <br /> Second HTML Line<br/> </body> </html>

  17. Page class events • Page_init • Page_load • Server_Controls • Page_prerender • Page_Unload

  18. ASP.NET Vs PHP

  19. Examples • quickstart – webforms • Intro4 shows VIEWSTATE • Intro6 shows a click event • Intro7 shows a usercontrol with a calander • Intro8 shows a db connection • Intro9 & 10 show asp.net templates • Intro11shows validation controls • Intro13 shows code behind pages • Server directives eg trace and debug • trace

  20. The lab environment. • IIS server – interdev.csse.monash.edu.au/cse2030…. • Each student has write access to their own directory on interdev (Sstudentnum) • URL: http:\\interdev.csse.monash.edu.au/cse2030/Sstudentnum/message.aspx • Alternative to .Net is webmatrix • Interdev is not accessible outside Monash network.

More Related