Date post: | 29-Dec-2015 |
Category: |
Documents |
Upload: | marlene-stone |
View: | 218 times |
Download: | 3 times |
ASP.NETWeb Application and Development
Digital Media Department
Unit Credit Value : 4EssentialLearning time : 120 hours
[email protected] Media DepartmentPoliteknik Brunei
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
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
Contents Cont. ASP .NET Server Controls HTML Server Controls Web Server Controls Validation Server Controls
4
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
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
7
ASP .NET Development Models
• Supports three different development models:• Web Pages• MVC -> Model View Controller• Web Forms
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
9
ASP .NET Development Models
• MVC• Separates web applications into 3 different components
• Models for data
• Views for display
• Controlers for input
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
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
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
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
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
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
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
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
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
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
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
Create ASP .NET Website with VS Express 2012 for Web
Step 1: Select File -> New Web Site
21
Create ASP .NET Website with VS Express 2012 for Web Cont.
Step 2: Select ASP.NET Web Site from the dialog box
22
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
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
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
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
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
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
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
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
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
ContactFor Tutorial and NotesCikguhadi.com
[email protected] Media DepartmentPoliteknik Brunei
Welcome to WADT