Presentation is loading. Please wait.

Presentation is loading. Please wait.

ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.

Similar presentations


Presentation on theme: "ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson."— Presentation transcript:

1 ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson

2 ASP-2-2 Internet Protocols TCP/IP is used to transport information around the Internet. TCP/IP can re-route traffic as needed. When a web page is requested, TCP provides the transmission format for the instruction. Before data is sent out, HTTP is used to put an address label on the data.

3 ASP-2-3 Web Page Addressing Utilizing HTTP, web pages are transferred from the server located at the Uniform Resource Locator (URL). The URL is used like an address. It has the name of the server being addressed. The physical address (TCP/IP) is determined from the name in the URL through the services of the ISP (DNS).

4 ASP-2-4 Hypertext Transfer Protocol HTTP messages contain information in a request and response line. Message information that is passed between computers can be examined by the ASP programmer. HTTP messages contain a request message and a response message, HTTP header, and HTTP body (resultant HTML code).

5 ASP-2-5 HTTP Request Line This is the first line of every HTTP request. Three of the most common types of methods available: –Get - this is a request for information. –Head - this is a request for header information only. –Post - this is a data transfer request to transfer data to the server.

6 ASP-2-6 HTTP Header The HTTP header contains details of information associated with the client. Header information consists of three parts: –General - information about the client or server –Entity - information about data being sent –Request - Information about client configuration and acceptable types of documents.

7 ASP-2-7 HTTP Response Line The response line is sent back to the client from the server. The response line contains two pieces of information: –HTTP version number – HTTP request code reporting success or failure of the request.

8 ASP-2-8 HTTP Response Line Codes HTTP response line codes are groups as follows: –100 - 199 is informational codes –200 - 299 is success codes –300 - 399 Request has not been performed –400 - 499 is client error codes –500 - 599 is server error codes

9 ASP-2-9 HTML Scripts Scripting languages can be embedded into the HTML page and are interpreted by the browser (or can be server-side scripting also). ASP uses a scripting language, but only on the server-side. With ASP, the browser sends server requests that cause the server to execute the script and generate HTML that is sent to the browser.

10 ASP-2-10 Scripting Languages There are a number of scripting languages, VBScript and Javascript are the most popular scripting languages being used. Jscript is a Microsoft version of the Javascripting language. The script must have an interpreter (script engine) to handle execution of the commands.

11 ASP-2-11 Client-Side Scripting Client-side scripting is accomplished by a script engine in the browser. Script tags ( ) are used to identify the script from standard HTML. The code that resides in between the tags is used to perform logic operations in conjunction with the HTML being presented by the browser.

12 ASP-2-12 Server-side Scripting Server-side scripts provide logic capability at the server to allow many different operations to take place associated with the response back to the client. The tags associated to server-side ASP scripting is the tags. It is possible to use the tag with RUNAT=SERVER within an ASP file.

13 ASP-2-13 IIS Handling of ASP Pages When IIS receives a request it checks the file extension of the requested page. The ASP script host (asp.dll) is then sent the requested page to be executed. Any VBScript or Jscript is farmed out to the appropriate script engine and the ASP code is executed. The ASP script host then puts it all back together and sends it to the client.

14 ASP-2-14 Server Caching IIS servers cache information from one request to another. If a request has been executed recently the results returned to the browser could very likely be from the server cache. The problem with this is that changes may have occurred to the ASP file since the last request. If the request is sent multiple times the proper results will eventually be seen.

15 ASP-2-15 Client Script Advantages and Disadvantages Allows developer to create more functional web pages. Client side scripting is executed immediately (response times are faster). Executing scripts on client side takes the load off of the server. Disadvantage is you can’t depend on browser have the correct script engine. Another disadvantage is that code is visible to all users.

16 ASP-2-16 ASP Objects and Components Objects contain functions and information neatly encapsulated to manage interaction between the web server and and browser. Components are packages of related objects. ASP functionality is contained in seven intrinsic objects.

17 ASP-2-17 ASP Intrinsic Objects Request - used to deal with a client request Response - used to deal with a response back from the server to the client Server - provides common server functionality associated to server operations Application - used to represent a whole web application (used to manage contents of an application).

18 ASP-2-18 ASP Intrinsic Objects contd. Session - used to store information about a client session (e.g. maximum time that web server will wait for a user’s request. ObjectContext - used to manage transactions. Works in association with MTS on pre-windows 2000 systems. It is part of the Windows 2000 environment. ASPError - contains the details of all errors generated by an ASP script or the script host.

19 ASP-2-19 Active Server Components Components (DLL’s) that are part of the ASP supplied by Microsoft. They provide a wide range of capabilities to enhance ASP usage. Ad Rotator - ad rotator for a web page Browser Capabilities - used to determine browser support Content Linking - used to manage sets of web pages.

20 ASP-2-20 Active Server Components contd. Content Rotator - text Ad rotator (Displays text only) Counters - used to manipulate values. These are manually set. Logging Utility - allows applications to read IIS log files MyInfo - used for storing personal information about the server administrator. Page Counter - automatic page counting Permission Checker - permissions tracking for read or execution of a file Tools - miscellaneous set of properties, (e.g. checks to see if a file exist, etc.)

21 ASP-2-21 Microsoft Data Access Components The Microsoft Data Access Components (MDAC) provide a standard method of access to all types of databases utilizing Open Database Connectivity (ODBC). A group of objects in this component family are the Activex Data Objects (ADO). ADO’s allow data to be viewed, manipulated and updated through standard Microsoft techniques.

22 ASP-2-22 ASP Usage Any legal operation within VB is now available to the client machine through the use of these ActiveX objects. Using ADO objects allows connection to a database from the client. ADO will return Recordsets of data to the client for display in HTML.

23 ASP-2-23 ASP ADO Usage <% Set Connect = Server.CreateObject("ADODB.Connection" ) Connect.Open "MyDatabase" Set RecordSet = Connect.Execute("SELECT * FROM Customers") %>

24 ASP-2-24 ASP ADO Usage contd.

25 ASP-2-25 ASP ADO Usage contd. Using ADO, the open method could use optional parameters for username and password if the database being accessed required it. The data records would be displayed in the HTML returned to the client that is between the loop. The fields were accessed by number, but they can also be accessed by name.

26 ASP-2-26 ASP Form Usage ASP provides access to the native ASP objects, Request and Response. This provides the capability to collect data from the client through a form tag. The data in the client would be sent back to the server through the request object. This is similar to getting the data out of the URL. ASP must be saved with an ASP extension.


Download ppt "ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson."

Similar presentations


Ads by Google