1 / 24

COMP6325 Advanced Web Technologies

COMP6325 Advanced Web Technologies. Dr. Paul Walcott The University of the West Indies Session 5 – The Microsoft .NET Framework – Part II Summer 2008. Objectives. In this session the student will: Describe the ASP.NET framework Install ASP.NET Create an ASP.NET application.

morgan
Télécharger la présentation

COMP6325 Advanced Web Technologies

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. COMP6325 Advanced Web Technologies Dr. Paul Walcott The University of the West Indies Session 5 – The Microsoft .NET Framework – Part II Summer 2008

  2. Objectives • In this session the student will: • Describe the ASP.NET framework • Install ASP.NET • Create an ASP.NET application

  3. Motivation(Platt 2003) • In the early days of the web, servers delivered static web pages • Written using HTML and CSS • Static pages do not work, however when users want to make ad hoc queries to a system

  4. Motivation cont’d • A dynamic system requires: • Program logic associated with page requests • User input, system output • User identification • User session management

  5. What is ASP.NET? “ASP.NET is a sever-side framework for developing Web applications based on the Microsoft .NET Framework.” (Yank 2002)

  6. What is ASP.NET cont’d? • ASP.NET provides: • State management • Save to server or database • Security • Through Microsoft Passports or prefabricated authentication schemes • Abstraction away from HTML • Through Web forms and ASP.NET sever controls (web forms treated like desktop applications)

  7. What is ASP.NET cont’d? • ASP.NET has all of the benefits of the .NET framework • For example it supports multiple languages • The program logic and HTML output are separated in ASP.NET, making it easier to program and maintain

  8. Popularity of ASP.NET • Several web sites have been created using ASP.NET including: • www.Match.com

  9. Activity • Install ASP.NET and the Microsoft Internet Information Service (IIS) • Use the following resources to help you: • http://www.sitepoint.com/print/asp-dot-net-introduction • http://www.sitepoint.com/print/getting-started-asp-net

  10. Activity cont’d • Installing ASP.NET • Open a command window and type: • C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ aspnet_regiis.exe -i

  11. Activity cont’d • Installing Microsoft Internet Information Services (IIS) • Open the Control Panel • Double mouse click on Add or Remove Programs • On the right-hand side of the Add or Remove Program (that appears) click the Add/Remove Windows Component icon • Scroll down the list of components that appear and select Internet Information Services (IIS) • follow the installation instructions

  12. Activity cont’d • Configuring Microsoft IIS • Open the control panel • Double-click the Administrative Tools icon • Double-click the Internet Information Services Icon. • Select the Home Directory tab and set the location of the root directory to your website • Change the port address to 8080 • To test type http://localhost:8080/first.aspx • Note the file first.aspx needs to be placed in the root directory of your website

  13. Activity cont’d • Use this program to test your installation <%@ Page Language="C#" %> <html> <head> <title>My First ASP.NET Page</title> <script runat="server"> protected void Page_Load(Object Source, EventArgs E) { TimeLabel.Text = DateTime.Now.ToString(); } </script> </head> <body> <p>The time is: <asp:label runat="server" id="TimeLabel" /></p> </body> </html>

  14. ASP.NET page anatomy • ASP.NET pages are text files with an aspx extension When a browser requests an ASP.NET page, the ASP.NET runtime (as a component of the .NET Framework's Common Language Runtime, or CLR) parses and compiles the target file into a .NET Framework class. The application logic now contained within the new class is used in conjunction with the presentational HTML elements of the ASP.NET page to display dynamic content to the user. (Ruvalcaba 2004b)

  15. ASP.NET page anatomy cont’d • Some of the elements that make up an ASP.NET page include: • Directives • Code declaration blocks • Code render blocks • Server-side comments

  16. Directives • Directives control compilation, specify settings, allow debugging and importing of classes • Page directive – specifies the language • <%@ Page Language=“C#” %> • Import directive – imports classes/namespaces • <%@ Import Namespace=“System.Web.Mail” %>

  17. Code declaration blocks • Contains the application logic for the page • External code pages may also be specified in the script tag: <script runat=“server”> void method(){ // code } </script>

  18. Code declaration blocks cont’d • Note script tags can also have a language and src attribute • Specifies the language of the script • Specifies an external file for the script <script runat=“server” language=“C#” src=“file.cs”> … </script>

  19. Comments • Comments are specified by // or /* … */ in C# • To prevent items from being processed by ASP.NET use server-side comments • <%-- comment --%>

  20. Code render blocks • Used to define inline code and is executed when it is encountered • There are two types • Inline code <% string name=“Bob Smith”; %> • Inline expressions <% = name%>

  21. Activity • Read the following chapter: • http://sitepoint.com/print/vb-dot-net-c-sharp-programming

  22. Activity • Create a form that accepts the personal information of an individual and validate it using ASP.NET

  23. Conclusion • In this session • The ASP.NET framework was described • A simple ASP.NET application was developed

  24. References Platt, D., “Introducing Microsoft .NET”, Third Edition, Microsoft Press, 2003 Ruvalcaba, Z., “Build Your Own ASP.NET Website Using C# And VB.NET, Chapter 1 – Introduction to .NET and ASP.NET”, 2004. Available online at http://www.sitepoint.com/print/asp-dot-net-introduction Ruvalcaba, Z., “Build Your Own ASP.NET Website Using C# And VB.NET, Chapter 2 – ASP.NET Basics”, 2004. Available online at http://www.sitepoint.com/print/asp-dot-net-basics Yank, K., “Getting Started with ASP.NET”, 2002. Available online at http://www.sitepoint.com/print/getting-started-asp-net

More Related