42
Windows NT / 2000 Overview Norman White Stern School of Business

Windows NT / 2000 Overview

Embed Size (px)

DESCRIPTION

Windows NT / 2000 Overview. Norman White Stern School of Business. Windows 2000 as a Web Platform. What are the issues one needs to address in considering W2K as a web Platform? What is W2K? Several Variations Professional Server Advanced Server DataCenter Server. Professional. - PowerPoint PPT Presentation

Citation preview

Page 1: Windows NT / 2000 Overview

Windows NT / 2000 Overview

Norman White

Stern School of Business

Page 2: Windows NT / 2000 Overview

Windows 2000 as a Web Platform

• What are the issues one needs to address in considering W2K as a web Platform?

• What is W2K?– Several Variations

• Professional

• Server

• Advanced Server

• DataCenter Server

Page 3: Windows NT / 2000 Overview

Professional

• Upgrade to NT Workstation– Designed for single users, small workgroups– More secure and reliable than 98, NT etc.– Crashproof due to major system redesigns

Page 4: Windows NT / 2000 Overview

Win 2K Server

• Entry level Server Version

• Supports 5 connections

• IIS Web Server included

• Basic File and Print Sharing

• Can support up to 4 Processors

Page 5: Windows NT / 2000 Overview

Win 2K Advanced Server

• Supports multiple systems (up to 8 processors each)

• 25 users (more at $40/user)

• Semi fault tolerant

Page 6: Windows NT / 2000 Overview

Win 2K Data Center Server

• Mainframe competition

• 32 processor support

• System clustering support

• Can Scale up (more processors) or out (more Clusters)

• Designed for Mission critical environments

Page 7: Windows NT / 2000 Overview

Problems fixed/addressed under Win 2K

• Plug and play supports most (not all ) new devices

• Designed to be crash proof (claims are 99.999% up time for Win2K Data Center)– Windows File protection keeps new applications

from replacing DLLs with older or incompatible versions

– Reboots no longer necessary to install software– Terminal Services Access Client through IE

Page 8: Windows NT / 2000 Overview

What about Win2K as a Web Platform?

• IIS - Top Rated Web server, easier to administer than Unix servers

• Supports most common add-ons like Php, PERL, etc.

• In addition supports ASP, Active Server Pages• Also supports Front Page Extensions which

allow Front Page users advanced development tools

Page 9: Windows NT / 2000 Overview

Win2K /IIS

• IIS also includes a built-in Indexing Server for searching content

• “Virtual sites” allow you make any folder on the system appear as a /directory under the root directory.

• ODBC support of Win2K allows easy access from ASP to other databases, either local or remote

Page 10: Windows NT / 2000 Overview

IIS/ASP Integration with Office

• IIS and Office are tightly integrated in Office 2000

• Office applications can be used to directly generate Web applications, including Data Base applications

• Integration makes it a great development environment for prototyping

• But first, what is ASP?

Page 11: Windows NT / 2000 Overview

Active Server Pages

• Concept is to have web pages that dynamically change (at the server) depending on external events (data, time, client, form inout etc).

• ASP is Visual Basic Code embedded in the web page (like Javascript) and interpreted at the server before the page is delivered.

Page 12: Windows NT / 2000 Overview

ASP Processing

• Unlike CGI processing and some other approaches, the ASP processor is part of the IIS web server (just as javascript is part of the browser.

• This means that the OS does not have to start up another application on every page.

• If the page has an ASP extension, the web server will look for embedded ASP code.

Page 13: Windows NT / 2000 Overview

ASP coding

• Whenever the web server finds an ASP reference, it turns control over to ASP. The ASP processor executes the instructions and the returns control to the web server. Since the ASP processor is part of the web server, it can do things like generate HTML directly.

• But it can also do almost anything you can do in VB, including data base access.

Page 14: Windows NT / 2000 Overview

More ASPForms

• Since ASP is part of the WEB server access to form information is much easier than most other approaches.

• Var = request.form(“fieldname”);– will place contents of field “fieldname” in

Variable “Var”– (nicer than Unix shell huh?)

Page 15: Windows NT / 2000 Overview

ASP and Office

• Even better is the ability of Office to generate working ASP applications

• Just click on “save as” and scroll down to the Active Server Pages option– Office will generate a set of ASP files that

implements the application on the WEB using ASP.

• Then move application to the web server and run

Page 16: Windows NT / 2000 Overview

ASP and Databases

• ASP accesses data bases using ODBC (Open Data Base Connectivity ) now called ADO (ActiveX Data Objects) and MDAC

• The name keeps changing, but the concept is the same– Application Opens a data base connection to a

local data object (which can point to remote data)

– It then manipulates the data base

Page 17: Windows NT / 2000 Overview

ODBC Naming

• As long as the ODBC name is the same on the system you develop app and the web server, everything should run on the web server (or else you need to change the name)

• To add an ODBC data source to a system,

• Click on Start, Settings, Control Panel, ODBC Data Sources (32 bit)

• Give the Data source a name, and then pick the database system, the server and the userid and password

Page 18: Windows NT / 2000 Overview
Page 19: Windows NT / 2000 Overview

Sample ASP file

• <%@ Language=VBScript %>

• <html>

• <head>

• <title>Example 1</title>

• </head>

• <body>

• <%

• FirstVar = "Hello world!"

• %>

• <%=FirstVar%>

• </body>

• </html>

Page 20: Windows NT / 2000 Overview

Looping in ASP

• <%@ Language=VBScript %>• <html>• <head>• <title>Example 2</title>• </head>• <body>• <%• FirstVar = "Hello world!"• %>• <%FOR i=1 TO 10%>• <%=FirstVar%>• <%NEXT%>• </body>• </html>

Page 21: Windows NT / 2000 Overview

Functions in ASP

• <%@ Language=VBScript %>• <html>• <head>• <title>Example 3</title>• </head>• <body>• <%• FirstVar = "Hello world!"• %>• The time is: <%=time%> <BR>• <%FOR i=1 TO 10%>• <%=FirstVar%>• <%NEXT%>• </body>• </html>

Page 22: Windows NT / 2000 Overview

Conditional Execution in ASP

• %@ Language=VBScript %>• <html>• <head>• <title>Example 4</title>• </head>• <body>• <%IF Hour(time)>18 OR Hour(time)<4 THEN%>• Good Night Everyone.• <%ELSE%>• Good Morning Everyone.• <%END IF%>• </body>• </html>

Page 23: Windows NT / 2000 Overview

Sample Form(from Microsoft ASP Tutorial)

• <html>• <head>• <title>Button Form</title>• </head>• <body>• <FORM NAME="Button Example" METHOD="POST" ACTION="tutorial/button.htm">• Computer Programming Experience:• <P>• <INPUT TYPE="button" NAME="choice" VALUE="Less than 1">Less than 1 year.<BR>• <INPUT TYPE="button" NAME="choice" VALUE="1 to 5">1-5 years.<BR>• <INPUT TYPE="button" NAME="choice" VALUE="More than 5">More than 5 years.• </P>• <P><INPUT TYPE="reset" VALUE="Clear Form">• <INPUT TYPE="submit" VALUE="Submit">• </P>• </form>• </body>• </html>

Page 24: Windows NT / 2000 Overview

Guestbook Application

• Need to– Create Database using Access

• I.e. create Table and fields

– Move Data Base to web server or create database in c:\inetpub\wwwroot\Tutorial\

• (Default web server root)

– Create ODBC DSN for Database– Create ASP application (guestbook.asp)

Page 25: Windows NT / 2000 Overview

Guest Data Base fields

• Field Name

• Data Type and General Properties

• ID

• AutoNumber, Field Size=Long Integer, New Values=Increment,

• Indexed=Yes(No Duplicates)

• TB1

• Text, Field Size=255, Required=No, Allow Zero Length=Yes,

• Indexed=No

• TB2

• Text, Field Size=255, Required=No, Allow Zero Length=Yes,

• Indexed=No

• TB3

• Text, Field Size=255, Required=No, Allow Zero Length=Yes,

• Indexed=No

• TB4

• Text, Field Size=255, Required=No, Allow Zero Length=Yes,

• Indexed=No

• MB1

• Memo, Required=No, Allow Zero Length=Yes

Page 26: Windows NT / 2000 Overview

Creating ODBC Data Source

• 1.In the ODBC Data Source Administrator, select the ODBC icon.

• 2.Select File DSN.

• 3.Select Add, select Microsoft Access Driver, and click Next.

• 4.Type in a descriptive name for your file DSN (Guestbook) and click Next.

• 5.Click Finish, click Select, specify the location of the database file, and select OK.

• 6.Click OK twice. After you specify the location of the database file, the ODBC Data Source Administrator creates a file DSN for it.

Page 27: Windows NT / 2000 Overview
Page 28: Windows NT / 2000 Overview
Page 29: Windows NT / 2000 Overview
Page 30: Windows NT / 2000 Overview

The Application LogicGuestbook.asp

• See if “Message” field (hidden) is True– If true, retrieve field values and insert new entry into the

database table

• Message not True– If message is not true, generate the form – with a hidden field “message” = TRUE– and have the action statement run Guestbook.asp (this asp file

• Note, only one file – It either processes the input, or generates the form for the

input.

Page 31: Windows NT / 2000 Overview

Guestbook.ASP file(put in c:\inetpub\wwwroot\Tutorial)

• <% @Language=VBScript %>• <html dir=ltr>• <head>• <TITLE>Guest Book</TITLE>• </head>• <body bgcolor="#FFFFFF" text="#000000">• <% • IF request.form ("Message")="True" THEN• strTB1=request.form("To")• strTB2=request.form("EMailAdd")• strTB3=request.form("CC")• strTB4=request.form("Subject")• strMB1=request.form("Memo")• IF strMB1 = "" THEN• iLenMB1=255• ELSE• iLenMB1 = Len(strMB1)• END IF

Page 32: Windows NT / 2000 Overview

Create the Database connection

• ‘Connects to the Access driver and Access database in the Inetpub• ‘directory where the database is saved• strProvider = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\

Inetpub\Wwwroot\Tutorial\guestbook.mdb;"• ‘Creates an instance of an Active Server component• set objConn = server.createobject("ADODB.Connection")• ‘Opens the connection to the data store• objConn.Open strProvider• ‘Instantiate Command object and use ActiveConnection property to• ‘attach connection to Command object• set cm = Server.CreateObject("ADODB.Command")• cm.ActiveConnection = objConn

Page 33: Windows NT / 2000 Overview

Create an SQL Query

• ‘Define SQL query

• cm.CommandText ="INSERT INTO Guestbook (TB1,TB2,TB3,TB4,MB1) VALUES (?,?,?,?,?)"

• ‘Define query parameter configuration information for guestbook fields• set objparam=cm.createparameter(, 200, , 255, strTB1)• cm.parameters.append objparam• set objparam=cm.createparameter(, 200, , 255, strTB2)• cm.parameters.append objparam• set objparam=cm.createparameter(, 200, , 255, strTB3)• cm.parameters.append objparam• set objparam=cm.createparameter(, 200, , 255, strTB4)• cm.parameters.append objparam• set objparam=cm.createparameter(, 201, , iLenMB1, strMB1)• cm.parameters.append objparam• cm.execute• response.write("Thank you!")

Page 34: Windows NT / 2000 Overview

Handle New Entries• ELSE%>

• <h1>Guestbook</h1>• <!--Post information to Guestbook form -->• <form name=guestbook.asp action="guestbook.asp" method="POST">• <p>To</p>• <p><input type="Text" name="To"></p>• <p>Email Address</p>• <p><input type="Text" name="EmailAdd"></p>• <p> CC</p>• <p><input type="Text" name="CC"></p>• <p>Subject</p>• <p><input type="Text" name="Subject"></p>• <p>Message</p>• <p><textarea name="Memo" rows=6 cols=70></textarea></p> • <input type="HIDDEN" name="Message" value="True">• <input type="submit" value="Submit information">• </form>• <%End if%>• </body>• </html>

Page 35: Windows NT / 2000 Overview

So, How hard is that?

• Not too bad, but how does someone look at the guestbook?

• Need another ASP file to view entries

• Nice to allow users to sort entries...

Page 36: Windows NT / 2000 Overview

Viewing Program

• <% @Language=VBScript %>• <html dir=ltr>• <head>• <title>View Guest Book</title>• </head>• <body bgcolor="#FFFFFF" text="#000000">• <%• ‘This section makes it possible for visitors to sort the data in the columns in

ascending order.• if request.form("sort")<> "" THEN• StrSort=request.form("sort") • ELSE• StrSort="TB1 ASC"• END IF

Page 37: Windows NT / 2000 Overview

Connect to Guestbook and create query

• strQuery="SELECT * FROM Guestbook ORDER BY " &StrSort• ‘Database path statement describing the driver to use and the path to the desired database.• strProvider = "Driver=Microsoft Access Driver (*.mdb); DBQ=C:\Inetpub\Wwwroot\

Tutorial\guestbook.mdb;"• IF Request("ID") <> "" THEN• strIDNum=Request("ID")• ‘Creates an instance of an Active server component• set objConn = server.createobject("ADODB.Connection")• ‘Opens the connection to the data store• objConn.Open strProvider• ‘Instantiate Command object and use ActiveConnection property to• ‘attach connection to Command object• set cm = Server.CreateObject("ADODB.Command")• cm.ActiveConnection = objConn

Page 38: Windows NT / 2000 Overview

• ‘Define SQL query

• cm.CommandText = "DELETE FROM Guestbook WHERE ID = " &strIDNum

• cm.Execute

• END IF

• ‘Instantiate a Recordset object and open a recordset using

• ‘the Open method

• Set rst = Server.CreateObject("ADODB.recordset")

• rst.Open strQuery, strProvider

• %>

Page 39: Windows NT / 2000 Overview

• <h1>Guest Book</h1>

• <form name=viewdb.asp action=viewdb.asp method=post>

• <table border=1 cellspacing=3 cellpadding=3 rules=box>

• <%

• ON ERROR RESUME NEXT

• IF rst.EOF THEN

• Response.Write "There are no entries in the database."

• ELSE%>

• <tr>

Page 40: Windows NT / 2000 Overview

• <%

• ‘Deletes rows from the database, this cannot be undone

• Response.Write "<td width=200><center>Delete Record</center></td>"

• FOR i = 1 to rst.Fields.Count -1

• Response.Write "<td width=200><input name=sort value=" & rst(i).Name & " type=submit></td>"

• NEXT

• WHILE NOT rst.EOF %>

• <tr>

• <%

• Response.Write "<td align=left valign=top bgcolor=‘#ffffff’><a href=viewdb.asp?id=" & rst(0) & ">Delete</a></td>"

• FOR i = 1 to rst.fields.count - 1

• Response.Write "<td align=left valign=top bgcolor=‘#ffffff’>" & rst(i) &"</td>"

• NEXT

• rst.MoveNext

• WEND

• END IF

• %>

• </table>

• </form>

• </body>

• </html>

Page 41: Windows NT / 2000 Overview

What is happening?What does the code do?

• Hint, What do you think the name of the asp file is?

Page 42: Windows NT / 2000 Overview

Conclusion

• Win2K fast development environment• Integrated with Office• BUT• Win2K still not a mature platform• Needs

– Something like a standard shell language– Batch queues with priorities– Priority for different applications etc.

• Excellent system for small – medium businesses.• Still problematical for very large sites, but moving fast.