1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
-
Upload
randolph-clarence-cunningham -
Category
Documents
-
view
222 -
download
1
Transcript of 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
![Page 1: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/1.jpg)
1
CS 3870/CS 5870
Static and Dynamic Web Pages
ASP.NET and IIS
![Page 2: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/2.jpg)
2
Static Web Pages
• Original HTML documents• Remaining the same after created and modified• At all times and to all users• All three pages of Lab1 are static
![Page 3: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/3.jpg)
3
Static Web Pages
• Cannot be used for business operations• No user input• Cannot respond to different user requests
![Page 4: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/4.jpg)
4
Dynamic Web Pages
• Interactive or Smart HTML pages• User input and Server Response• Web Applications • Similar to Windows programs• Lab 2
![Page 5: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/5.jpg)
5
Special HTML Controls
• To get user input• Element INPUT• Element BUTTON• Element FORM• …
![Page 6: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/6.jpg)
6
Control Types Created with INPUT
• Text• Password• Checkbox• Radio box• Submit• Reset• Hidden• Button• File• Image• . . .
![Page 7: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/7.jpg)
7
HTML Forms
Controls to get user input should be inside HTML forms
![Page 8: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/8.jpg)
8
HTML Controls and Forms
Example
Source Code
![Page 9: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/9.jpg)
9
HTML Standards
HTML 4.01 Specification
HTML Current Status
![Page 10: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/10.jpg)
10
Scripts for Dynamic Web Pages
• User input and Server Response• Similar to Windows programs• Need code to respond to user input
– Client Side Scripting
– Server Side Scripting
– Combination of above two approaches
![Page 11: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/11.jpg)
11
Client Side Scripting
• HTML files and instruction files sent to client• Client Script • JavaScript• VBScript• Java Applets• Flash • . . .
![Page 12: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/12.jpg)
12
Issues with Client Side Scripting
• Different browsers may interpret instructions in different ways
• Database is normally at server site
• Users could view source code
![Page 13: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/13.jpg)
13
Server Side Scripting
• Instruction files are at server site • HTML files are generated according to user input• Only HTML files are sent to clients
![Page 14: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/14.jpg)
14
Issues with Server Side Scripting
• Most computing is done at the server• Nothing will work when the server is down• More internet traffic• Powerful and expensive servers
![Page 15: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/15.jpg)
15
Different Technologies forServer Side Scripting
• CGI (Common Gateway Interface)
• JSP (Java Server Pages)
• PHP (Personal Home Pages)
• ASP (Active Server Pages)
• ASP.NET • . . .
![Page 16: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/16.jpg)
16
ASP.NET
• A server-side technology for creating dynamic web pages
• Client-side scripting is incorporated (e.g., to check input)• VB.NET or any other language
supported by .NET• Working with MS IIS
![Page 17: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/17.jpg)
17
Internet Information Services (IIS)
• IIS waits and takes client requests
• IIS sends static HTML files to the clients
• IIS passes client requests to ASP.NET when needed
• ASP.NET generates dynamic web pages
• IIS sends dynamic web pages to clients
![Page 18: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/18.jpg)
18
Windows Server Xray
• In domain ION• Our Web Sites• Individual student accounts
Each student has a Web site on Xray
![Page 19: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/19.jpg)
19
Open Your Web Site on Xray
• Start VS 2012• Open Web Site• Remote Site• https://xray.ion.uwplatt.edu/UserName• Login using your UWP UserName and
Password
• Do not try New Project or New Web Site!
![Page 20: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/20.jpg)
20
Lab 2
• 20 points
• Due 5 pm, Monday, September 15
• Sample Program
![Page 21: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/21.jpg)
21
Creating Folder
• Solution Explore• Right Click on Web Site• New Folder• Lab2
![Page 22: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/22.jpg)
Creating Web Forms
• Solution Explorer
• Right clicking folder
• Add
• Web Forms
22
![Page 23: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/23.jpg)
23
Page Default.aspx
Similar to index.html
Static page for Lab2
Similar to pages of Lab1
![Page 24: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/24.jpg)
Adding Content to Default.aspx
• Similar to Lab1
• Copy and Paste, including the CSS file
<body>
<form id="form1" runat="server">
<h1 class="CS3870Title">Web Protocols, Technologies and Applications </h1>
<h2 class="CS3870Name">Qi Yang</h2>
<%-- navigation bar --%>
</form>
</body>24
![Page 25: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/25.jpg)
25
External CSS Files in Other Locations
<head>
<link rel="stylesheet" type="text/css" href=“../StyleSheet.css" />
<title>CS3870/CS5870 – Lab2</title>
</head>
<body>
<ul class="navbar">
<li> <a href="http://www.uwplatt.edu/csse/">Absolute link </a></li>
<li> <a href=“HtmlPage2.html"/>Relative link</a></li>
</ul>
</body>
</html>
![Page 26: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/26.jpg)
26
Page OrderingProduct.aspx
Dynamic page
Adding controls
Adding code
VB
C#
. . .
![Page 27: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/27.jpg)
Creating Page OrderingProduct.aspx
• Solution Explorer
• Right clicking folder
• Add
• Add New Items– Visual basic– Web Form– File name– Place code in separate file– (Select Master Page)
27
![Page 28: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/28.jpg)
28
ASP.NET Server Controls
• HTML Server Controls– HTML server controls are HTML tags understood by the
server
• 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.
• All Server Controls must be within a <form> tag.
• All Server Controls must have the runat="server" attribute.
![Page 29: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/29.jpg)
29
Adding and Formatting Controls
• ToolBox
• Standard (not HTML)
• Setting control properties
• Style– Source View
• Format Menu– Set Position
• Absolute
• Relative
• CSS file
![Page 30: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/30.jpg)
Event Procedures
Same as Windows programs
Compute Square Root
TextBox2.Text = FormatNumber(Math.Sqrt(Textbox2.Text), 2)
30
![Page 31: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/31.jpg)
31
Formatting Output
• Style in HTML source• Properties Window• VB.NET procedures in VB file• VB function
– Format
– FormatCurrency
– FormatCurrency
– . . .
![Page 32: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/32.jpg)
Checking Input
• Click event of button Compute
• Server site scripting
• Client site scripting should be better
• Should do it on both sites
• Control Validator
32
![Page 33: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/33.jpg)
Validators
• ToolBox• Validation Tab• RequiredFieldValidator• RangeValidator• CompareValidator
– Type– Operator– Value to compare
33
![Page 34: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/34.jpg)
34
Validation Controls
• Validate input automatically• We don’t check input any more
• Must set button property CausesValidation to True!
![Page 35: 1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.](https://reader036.fdocuments.us/reader036/viewer/2022062421/56649e155503460f94aff088/html5/thumbnails/35.jpg)
35
Lab 2
You will lose five points for each late day!
Even the server is having issues!
More to discuss Thursday!
No Lab Time for Lab2!