1 / 17

ASP.NET

ASP.NET. Another “brief” Overview. ASP.NET. Increasingly the Web and the browser interface are used to support application development. ASP.NET is not a CLR-based language. ASP.NET is part of the class library

idalee
Download Presentation

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. ASP.NET Another “brief” Overview

  2. ASP.NET • Increasingly the Web and the browser interface are used to support application development. • ASP.NET is not a CLR-based language. • ASP.NET is part of the class library • In “classic” ASP, VBscript was the default language for developing ASP pages (part of the reason so much VB is out there.... • VBscript is not part of the framework. • ASP.NET applications are written in a CLR-based language (e.g., VB or c#)

  3. code-behind Default.aspx.cs Default.aspx Compiled Into MSIL IIS Browser Default.aspx http Web Controls ADO.NET txtLogin Validate person txtPwd Person.cs cmdLogin dbms Common Language Runtime

  4. aspx pages • ASP.Net is not a scripted environment like classic ASP. All pages are compiled into classes that run on the CLR. • The “output” of an aspx is HTML 4.0 which is sent to the requesting browser via the web server.

  5. aspx pages • In classic ASP, each page is processed sequentially and interpreted rather than compiled. • There was really only one “event” in this model: “page was requested.” • ASP.Net is a fully event-driven environment.

  6. aspx pages • Classic ASP versus ASP.Net • SQL Injection example • ASPX page life cycle • Critical understanding for programming controls

  7. ASPX page life cycle • http://msdn2.microsoft.com/en-us/library/ms178472.aspx http://www.4guysfromrolla.com/images/pageLifeCycle.gif

  8. PostBack • IsPostBack • Property that indicates whether page is loaded for first time or the result of a user gesture // Placed in the Page_load event // C# if (!IsPostBack) { SetFormMode(); } // Vb.Net If Not IsPostBack Then SetFormMode() End If

  9. Web Controls • Web controls are an alternative to HTML controls. • An aspx page can have both

  10. Web Controls HTML Controls You can tell if it is a web or HTML control because web controls have a little green arrow in the corner.

  11. Code-behind • Mixing markup tags and presentation logic syntax makes a page very difficult to read and maintain. • Code-behind separates the markup tags from code in a separate file. • The aspx and aspx.vb files are linked by a reference.

  12. The two files are linked

  13. Code-behind • The code in a code-behind page could be written inline with script blocks • <script runat=“server”></script> • Or render blocks • <% %> • For example, in main.aspx (previous version of SQL Exercise System) I use a render block to print the content of the treeview.

  14. I use the Write method of the Response object to print the contents of the variable I populated in the code-behind page in the page_load event.

  15. This treeview is generated dynamically from the database and then rendered by Response.Write method.

  16. Code-behind • Although you can still write code directly in the aspx page, code-behind means: • Clean separation of HTML and code • Easier Reuse • Simpler Maintenance • Deployment without source code

More Related