26b6e43155cccbd4d163baba9238b65b.ppt
- Количество слайдов: 24
11. Web-based Applications
Objectives “Real-world applications are typically multi-tier, distributed designs involving many components — the web server being perhaps the most important component in today's applications. . . ” • Web-based applications • IIS • Static vs. dynamic web apps Visual Studio. NET 2
Part 1 • Web-based applications… Visual Studio. NET 3
Web application • Web server is just another tier • Application now accessible over the internet – from any client platform! Web Page Browser obj obj Web Server (IIS) ANY platform Windows Server HTML / HTTP Presentation Visual Studio. NET Business Data Access Data 4
Why? • Web-based apps offer many advantages: – extend reach of application to people AND platform – based on open, non-proprietary technologies Visual Studio. NET 5
Types of web apps • Two types: – Web. Forms: HTML – Web. Services: browser GUI-based app displayed in browser via object-based app returning raw XML HTML Web Page obj custom FE SOAP, XML other App Visual Studio. NET obj Web server 6
Example: workshop web site Visual Studio. NET 7
Behind the scenes… (1) http: //server/page. asp Browser (2) HTML Web Page Web server <title>RWWP. NET, July 2002</title> <html> <h 3>RWWP. NET, July 2002</h 3> <HR> <ol> <li> Lowell Carmony <li> Don Schwing <li> Kamal Dahbur. . . </ol> <HR> </html> Visual Studio. NET 8
The key to web-based programming… • It's a client-server relationship – client makes request – server does some processing… – client sees OUTPUT of server-side processing Visual Studio. NET 9
Part 2 • IIS… Visual Studio. NET 10
Internet Information Services (IIS) • IIS is Microsoft's Web Server – runs as a separate process "inetinfo. exe" – requires a server-like OS: Windows NT, 2000, XP Pro, 2003 – multi-threaded to service thousands of requests… client IIS client . . . Visual Studio. NET Windows Server 11
Configuring IIS • Configured manually via: – control panel, admin tools, Internet Information Services Visual Studio. NET 12
A web site • IIS deals with web sites • A web site = a web application • How IIS works: – each web site has its own physical directory on hard disk – each web site is assigned a virtual name for that directory – users surf to web site based on virtual name • Example: – web site lives in C: InetpubwwwrootWeb. Site – web site's virtual name is "AAAPainting" – IIS maps virtual to physical… Visual Studio. NET 13
Creating a virtual directory • When in doubt, right-click : -) – right-click on "Default Web Site", New, Virtual Directory… Visual Studio. NET 14
Part 3 • Static vs. dynamic web sites… Visual Studio. NET 15
Types of web sites • From IIS's perspective, 2 types: – static – dynamic Visual Studio. NET 16
Static web sites • A static web site has the following characteristics: 1. all web pages are pre-created and sitting on hard disk 2. web server returns pages without any processing <title>Welcome to AAA Painting</title> <html> <h 3>Welcome <HR> <ol> <li> <A </ol> <HR> </html> Visual Studio. NET to AAA Painting</h 3> HREF="history. htm">History of our company</A> HREF="prices. htm">Pricing</A> HREF="contact-info. htm">How to contact us</A> 17
HTML • Static web sites are typically pure HTML – pages may also contain script code that runs on client-side <title>Welcome to AAA Painting</title> <html> <h 3>Welcome <HR> <ol> <li> <A </ol> <HR> </html> to AAA Painting</h 3> HREF="history. htm">History of our company</A> HREF="prices. htm">Pricing</A> HREF="contact-info. htm">How to contact us</A> Visual Studio. NET 18
Dynamic web sites • A dynamic web site involves server-side processing • How does IIS tell the difference? – based on file extension of requested web page… • Example: – static request: http: //localhost/AAAPainting/default. htm – dynamic request: http: //localhost/Workshop/default. asp Visual Studio. NET 19
ASP • Active Server Pages • Microsoft's server-side programming technology – ASP based on scripting languages, interpreted – ASP. NET based on. NET languages, compiled, faster, … http: //host/page. asp client HTML ASP engine IIS Visual Studio. NET 20
Example • We want to dynamically create web page of attendee's – i. e. generate the page by reading names from a database ASP Page IIS Visual Studio. NET 21
ASP page — part 1, presentation default. asp • ASP page = HTML + code… <title>RWWP. NET, July 2002</title> inline code block <html> <h 3>RWWP. NET, July 2002</h 3> <HR> List of attendees: <ol> <% Call Output. Attendees( ) %> </ol> <HR> </html> <SCRIPT LANGUAGE="VBScript" Run. At="Server"> Sub Output. Attendees(). . . Visual Studio. NET 22
ASP page — part 2, logic Sub Output. Attendees() Dim db. Conn, rs, sql, first. Name, last. Name sql = "Select * From Attendees" Set db. Conn = Create. Object("ADODB. Connection") Set rs = Create. Object("ADODB. Record. Set") db. Conn. Open("Provider=Microsoft. Jet. OLEDB. 4. 0; " + _ "Data Source=C: InetpubwwwrootWorkshopAttendees. mdb") rs. Active. Connection = db. Conn : rs. Source = sql : rs. Open Do While Not rs. EOF first. Name = rs("First. Name") last. Name = rs("Last. Name") Response. Write("<li> " + first. Name + " " + last. Name) rs. Move. Next() Loop rs. Close : db. Conn. Close End Sub </SCRIPT> Visual Studio. NET 23
Summary • Web-based applications are commonplace • Web-based applications are often mission-critical • Two types: – Web. Forms: form-based – Web Services: object-based Visual Studio. NET 24
26b6e43155cccbd4d163baba9238b65b.ppt