Asp.Net Ajax
Total Page:16
File Type:pdf, Size:1020Kb
ASP.NET MATERIAL INTRODUCTION TO WEB TECHNOLOGIES Introduction to scripts: • Html & Java Script: A client-side script is a program that may accompany an HTML document or be embedded directly in it. The program executes on the client's machine when the document loads, or at some other time such as when a link is activated. HTML's support for scripts is independent of the scripting language. Scripts offer authors a means to extend HTML documents in highly active and interactive ways. For example: • Scripts may be evaluated as a document loads to modify the contents of the document dynamically. • Scripts may accompany a form to process input as it is entered. Designers may dynamically fill out parts of a form based on the values of other fields. They may also ensure that input data conforms to predetermined ranges of values, that fields are mutually consistent, etc. • Scripts may be triggered by events that affect the document, such as loading, unloading, element focus, mouse movement, etc. • Scripts may be linked to form controls (e.g., buttons) to produce graphical user interface elements. There are two types of scripts authors may attach to an HTML document: • Those that are executed one time when the document is loaded by the user agent. Scripts that appear within a SCRIPT element are executed when the document is loaded. For user agents that cannot or will not handle scripts, authors may include alternate content via the NOSCRIPT element. • Those that are executed every time a specific event occurs. These scripts may be assigned to a number of elements via the intrinsic event attributes. The SCRIPT Element: <!ELEMENT SCRIPT - - %Script; -- script statements --> <!ATTLIST SCRIPT Page 1 ASP.NET MATERIAL charset %Charset; #IMPLIED -- char encoding of linked resource -- type %Content Type; #REQUIRED -- content type of script language – src %URI; #IMPLIED -- URI for an external script -- defer (defer) #IMPLIED -- UA may defer execution of script -- • Script Technologies: The following table lists the Windows script technologies and describes the functionality included in each technology. JScript : The powerful Microsoft scripting language targeted specifically at the Internet. JScript 5.8 is the Microsoft implementation of the ECMA 262 language. VBScript : Microsoft Visual Basic Scripting Edition brings active scripting to a wide variety of environments. These include Web client scripting in Microsoft Internet Explorer and Web server scripting in Microsoft Internet Information Services. Script Runtime : A Dictionary object is the equivalent of a PERL associative array. Items can be any form of data, and are stored in the array. The FileSystemObject (FSO) object model lets you use the familiar object. method syntax with a rich set of properties, methods, and events to process folders and files. Script Encoder is a simple command-line tool that enables script designers to encode their final script so that Web hosts and Web clients cannot view or modify their source. Windows Script Components : Microsoft Windows Script Components give you an easy way to create COM components using scripting languages such as Microsoft Visual Basic Scripting Edition (VBScript) and Microsoft JScript. Page 2 ASP.NET MATERIAL Windows Script Host: The Microsoft Windows Script Host (WSH) is a tool that lets you run Visual Basic Scripting Edition and JScript natively in the base operating system. Windows Script Interfaces: Microsoft Windows Script Interfaces provide a way for an application to add scripting and OLE Automation capabilities. • Client side scripting & Server side scripting Client-side: Client-side scripting enables interaction within a webpage. The code required to process user-input is downloaded and compiled by the browser or plug-in. An example of a client-side interaction is a rollover (typically triggered when choosing a navigation option). Client-side scripting languages include JavaScript. Server-side: With server-side scripting, completing an activity involves sending information to another computer (server) across the internet. The server then runs a program that processes the information and returns the results, typically a webpage. Search engines use server-side processing. When a keyword is sent, a program on a server matches the word or phrase entered against an index of website content. (To complete the same search as a client-side process would require the browser to download the entire search engine program and index.) Server-side scripting languages include ASP and PHP. Page 3 ASP.NET MATERIAL Client-side vs. Server-side Client-side interaction: • Response to interaction may be more immediate (once the program code has been downloaded) • Services are secure (as no information is sent from the browser) • Reliant on the user having using a specific browser and/or plug-in on their computer • Affected by the processing speed of the user’s computer Server-side interaction: Complex processes are often more efficient (as the program and the associated resources are not downloaded to the browser) There are security considerations when sending sensitive information Does not rely on the user having specific browser or plug-in Affected by the processing speed of the host server. Architecture in ASP.NET (IIS 6.0) This section provides an overview of the ASP.NET infrastructure and subsystem relationships, as they relate to the subject of security. The following illustration shows the relationships among the security systems in ASP.NET. Page 4 ASP.NET MATERIAL As the illustration shows, all Web clients communicate with ASP.NET applications through Internet Information Services (IIS). IIS deciphers and optionally authenticates the request. If Allow Anonymous is set to true, no authentication occurs. IIS also finds the requested resource (such as an ASP.NET application), and, if the client is authorized, returns the appropriate resource. In addition to the built-in ASP.NET features, an ASP.NET application can use the low- level security features of the .NET Framework. For more information, see the "Key Security Concepts" topic in .NET Framework Help. Integrating with IIS: When considering ASP.NET authentication, you should understand the interaction with IIS authentication services. IIS always assumes that a set of credentials maps to a Microsoft Windows NT account and uses them to authenticate a user. There are three different kinds of authentication available in IIS 5.0 through IIS 6.0: basic, digest, and Integrated Windows Authentication (NTLM or Kerberos). You can select the type of authentication to use in IIS administrative services. If you request a URL containing an ASP.NET application, the request and authentication information are handed off to the application. ASP.NET provides the two additional types of authentication described in the following table. ASP.NET Description authentication provider Forms A system by which unauthenticated requests are redirected to an authentication HTML form using HTTP client side redirection. The user provides credentials and submits the form. If the application authenticates the request, the system issues an authentication ticket in a cookie that contains the credentials or a key for reacquiring the identity. Subsequent requests are issued with the cookie in the request headers; they are authenticated and authorized by an ASP.NET handler using whatever validation method the application developer specifies. Passport Centralized authentication service provided by Microsoft that Page 5 ASP.NET MATERIAL ASP.NET Description authentication provider authentication offers a single logon and core profile services for member sites. • ASP Objects Introduction Objects are a way of encapsulating multiple methods (they're like functions) and variables in one easy to manage Uber-Variable (an Object). Objects in ASP resemble other Object Oriented Programming languages. In this lesson we will be using the ASP CDO.Message object as our example object to be dissected. ASP Object Overview: Objects were created to combat the increasing complexity of programming. The rationale for understanding and using Objects in your programming is to make programming easier and your code more human readable. ASP Create an Object - Server.CreateObject: An object in ASP is created by passing a name string to the Server.CreateObject function (actually referred to as a method). The string to create a Message object is "CDO.Message". We will be creating a CDO.Message object in this example. Note: Because objects are special there is a special way that you create and destroy them using the Set keyword. These areas are marked in red in the example below. ASP Code: <% Dim myObject Set myObject = Server.CreateObject ("CDO.Message") 'You must Set your objects to "nothing" to free up the 'the computer memory that was allocated to it Set myObject = nothing %> Page 6 ASP.NET MATERIAL Objects are a collection of related things that are combined into this blob of programming go that can be created and destroyed whenever we may need it. For example say that you wanted to make an object that allowed you to send an email... ASP Object Properties: These smaller variables are commonly referred to as an object's properties and the format for setting these properties is nearly identical to setting a variable equal to a value. The correct syntax for setting an object's properties is: objectName.propertyName = someValue In this tiny example below we are creating a new mail object and setting its To and From properties. ASP Code: <% Dim myObject Set myObject = Server.CreateObject("CDO.Message") 'Then we set the To and From properties myObject.To = "[email protected]" myObject.From = "[email protected]" 'You must Set your objects to "nothing" to free up the 'the computer memory that was allocated to it Set myObject = nothing %> Now I know we didn't DO anything in the above example, but we still need to learn a bit more about objects before we can get anything done! Objects, besides having a clump of associated common variables, may also have a collection of functions(which become referred to as methods) associated with them.