asp.net web application and development digital media department unit credit value : 4 essential...

32
ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours [email protected] Digital Media Department Politeknik Brunei

Upload: marlene-stone

Post on 29-Dec-2015

219 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

ASP.NETWeb Application and Development

Digital Media Department

Unit Credit Value : 4EssentialLearning time : 120 hours

[email protected] Media DepartmentPoliteknik Brunei

Page 2: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Contents What is ASP .NET? What is IIS? What is ASP .NET File? How Does ASP .NET Work? Installing Visual Studio Create ASP .NET Website with VS Express 2012 for

Web

2

Page 3: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Contents Cont. Location Options Files & Folders Used by ASP .NET Web Application Location of Web Site Files Inserting ASP .NET Code Into The Web pages Code-Behind Example Create ASP .NET Website With VS Express 2012 for

Web

3

Page 4: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Contents Cont. ASP .NET Server Controls HTML Server Controls Web Server Controls Validation Server Controls

4

Page 5: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

What is ASP .NET?

Definition:

ASP -> Active Server Pages Superset of HTML + Programs that get

rendered (the Active part) into plain HTML .Net

A well done but enormous object oriented distillation of all the services of Windows

5

Page 6: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

What is ASP .NET?

ASP.NET

A server side scripting technology that enables scripts (embedded in web pages) to be executed by an Internet server.

A Microsoft Technology.

A program that runs inside IIS.

6

Page 7: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

7

ASP .NET Development Models

• Supports three different development models:• Web Pages• MVC -> Model View Controller• Web Forms

Page 8: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

8

ASP .NET Development Models

• Web Pages• Simplest ASP.NET model

• Similar to PHP and classic ASP

• Built-in templates and helpers for database, video, graphics, social media and more

Page 9: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

9

ASP .NET Development Models

• MVC• Separates web applications into 3 different components

• Models for data

• Views for display

• Controlers for input

Page 10: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

10

ASP .NET Development Models

• Web Forms• The traditional ASP.NET event driven development model:

• Web pages with added server controls, server events, and server code

Page 11: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

What is IIS?

IIS (Internet Information Services) is Microsoft's

Internet server.

IIS comes as a free component with Windows servers.

IIS is also a part of Windows 2000 and XP Professional.

11

Page 12: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

12

Other Example of “Active” Pages

• Take “Active” to mean that a server processes non-HTML information to generate a final HTML page• Many other examples:• PHP, Perl, Active Java, javascript (client), Active Python, etc

• Without a concept of “Active” pages, every conceivable page would be “hard coded”

12

Page 13: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

What is ASP .NET File?

An ASP.NET file is just the same as an HTML file.

An ASP.NET file can contain HTML, XML, and scripts.

Scripts in an ASP.NET file are executed on the server.

An ASP.NET file has the file extension .aspx.

13

Page 14: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

14

ASP.NET Page

• The typical ASP.NET page is two files• foo.aspx Page layout• foo.aspx.cs “Code Behind” implementation

• The “.cs” refers to C#

• Separation of layout from implementation is a VERY good thing

14

Page 15: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

How Does ASP .NET Work?

When a browser requests an HTML file, the server

returns the file. When a browser requests an ASP.NET file, IIS passes

the request to the ASP.NET engine on the server. The ASP.NET engine reads the file, line by line, and

executes the scripts in the file. Finally, the ASP.NET file is returned to the browser as

plain HTML.

15

Page 16: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Installing Visual Studio

• You may opt to download and install Microsoft Visual Studio 2012 or Microsoft Visual Studio Express 2012 for Web

• Both have the trial version of 30 days and an extend of 90 days after you registered on the 30th day of the trial.

• Do not register before your 30 days trial is over.

16

Page 17: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Installing Visual Studio Cont.

• System Requirements (MS Visual Studio 2012/Express 2012 for Web):

• Supported Operating Systems are Windows 8, Windows 7, Windows Vista SP2, Windows XP SP3+, Windows Server 2003 SP2+, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012.

• You must have a live Internet connection.

• You must have administrator privileges on your computer to run the Web Platform Installer.

17

Page 18: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Installing Visual Studio Cont.

• Hardware Requirements:

• 1 GHz or faster processor

• 512 MB of RAM

• 850 MB of available hard disk space (x86)

• 2 GB hard drive (x64)

18

Page 19: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Installing Visual Studio Cont.

• Register VSEW online and get a key. Enter the key in the VSEW start-up screen

• If you’re using a commercial version of Visual Studio, there might be an option of different collections of settings the first time you start Visual Studio.

• The choice you make on that dialog box influences the layout of windows, toolboxes, menus, and shortcuts.

19

Page 20: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Installing Visual Studio Cont.

• Choose the Web Development settings because those settings are designed specifically for ASP.NET developers.

• You can always choose a different profile later by resetting your settings

20

Page 21: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Create ASP .NET Website with VS Express 2012 for Web

Step 1: Select File -> New Web Site

21

Page 22: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Create ASP .NET Website with VS Express 2012 for Web Cont.

Step 2: Select ASP.NET Web Site from the dialog box

22

Page 23: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Location Options

Default is File System: where web site is created in your machine on a local folder.

HTTP: A web site is created under the control of IIS server.

FTP: A web site is created on a remote hosting server that has IIS and ASP .NET installed.

23

Page 24: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Files & Folders Used by ASP .NET Web Application

Solution Explorer contains folders as in:

The other folders that can occur inside a project are:

App_Themes, Bin, etc.

24

Page 25: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Location of Web Site Files

Suppose you create a website WebSite1, the files

will be located inside: .sln file

C:\Users\moe6\Desktop\WAD Materials\WebSite1

All other files (.aspx, .aspx.cs, web.config, etc.)C:\Users\moe6\Desktop\WAD Materials\WebSite1

25

Page 26: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Inserting ASP .NET Code Into The Web Pages

3 ways of inserting ASP .NET code into your web

page: Inline code blocks Script tags Code-Behind Technique

Code-behind model separates HTML (presentation layer), from program logic (server-side code). This eliminates the dangerous practice of writing spaghetti code that is prone to error.

26

Page 27: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

ASP .NET Server Controls

There are three kinds of server controls: HTML Server Controls

Traditional HTML tags

Web Server Controls

Validation Server Controls For input validation

27

Page 28: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

HTML Server Controls

HTML server controls are HTML tags understood

by the server.

The purpose is to allow existing HTML elements to be processed by ASP .NET pages, and hence they map directly to existing HTML tags.

Add a runat="server" attribute to the HTML element to indicate that the element should be treated as a server control.

28

Page 29: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Web Server Controls

Web server controls are special ASP.NET tags

understood by the server.

Web server controls do not necessarily map to any existing HTML elements and they may represent more complex elements.

The syntax for creating a Web server control is:<asp:ctrl_name id="some_id" runat="server" />

29

Page 30: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Web Server Controls Cont.

Some of the web server controls are:

asp:Label asp:ListBox asp:DropDownBox asp:TextBox asp:RadioButton and asp:RadioButtonList asp:CheckList and asp:CheckListList asp:Button asp:Image asp:HyperLink etc…..

30

Page 31: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

Validation Server Controls

Validation server controls are

used to validate user-input.

If the user-input does not pass validation, it will display an error message to the user.

The validation server controls available are:

31

Page 32: ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Suhardi.suhaimi@pb.edu.bn Digital

ContactFor Tutorial and NotesCikguhadi.com

[email protected] Media DepartmentPoliteknik Brunei

Welcome to WADT