script - The University of the West Indies
Short Description
Download script - The University of the West Indies...
Description
COMP6325 Advanced Web Technologies Dr. Paul Walcott The University of the West Indies
Session 5 – The Microsoft .NET Framework – Part II Summer 2008
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Objectives
In this session the student will:
Describe the ASP.NET framework Install ASP.NET Create an ASP.NET application
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Motivation cont’d
A dynamic system requires:
Program logic associated with page requests User input, system output User identification User session management
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
What is ASP.NET? “ASP.NET is a sever-side framework for developing Web applications based on the Microsoft .NET Framework.” (Yank 2002)
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
What is ASP.NET cont’d?
ASP.NET provides:
State management
Security
Save to server or database 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)
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Popularity of ASP.NET
Several web sites have been created using ASP.NET including:
www.Match.com
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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-netintroduction http://www.sitepoint.com/print/getting-started-asp-net
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Activity cont’d
Installing ASP.NET
Open a command window and type:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50 727\ aspnet_regiis.exe -i
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Activity cont’d
Use this program to test your installation
My First ASP.NET Page protected void Page_Load(Object Source, EventArgs E) { TimeLabel.Text = DateTime.Now.ToString(); } The time is:
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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)
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Directives
Directives control compilation, specify settings, allow debugging and importing of classes
Page directive – specifies the language
Import directive – imports classes/namespaces
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Code declaration blocks
Contains the application logic for the page
External code pages may also be specified in the script tag: void method(){ // code }
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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 …
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Comments
Comments are specified by // or /* … */ in C# To prevent items from being processed by ASP.NET use server-side comments
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Code render blocks
Used to define inline code and is executed when it is encountered
There are two types
Inline code
Inline expressions
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Activity
Read the following chapter:
http://sitepoint.com/print/vb-dot-net-c-sharpprogramming
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Activity
Create a form that accepts the personal information of an individual and validate it using ASP.NET
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
Conclusion
In this session
The ASP.NET framework was described A simple ASP.NET application was developed
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
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
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill Campus
View more...
Comments