Presentation is loading. Please wait.

Presentation is loading. Please wait.

Active Server Pages Submitted to Dr. Virginia F. Kleist Submitted by Soundar Nadarajan.

Similar presentations


Presentation on theme: "Active Server Pages Submitted to Dr. Virginia F. Kleist Submitted by Soundar Nadarajan."— Presentation transcript:

1 Active Server Pages Submitted to Dr. Virginia F. Kleist Submitted by Soundar Nadarajan

2 Contents:  Background & History  ASP Vs HTML  ASP Vs JSP  Overview  Examples  Development Environment  Advantages and Disadvantages  Utility in ecommerce  Usage in Projects  Future Trends  References

3 Background & History  ASP was "born" in November 1996 when Microsoft announced its design of an Active Platform.  The Active Platform reflects Microsoft's ideas about how a desktop computer and a server computer should communicate. It consists of two parts: the Active Desktop and the Active Server.  The Active Desktop refers to the client side, or the user's side, where HTML files are displayed on a web browser.  The Active Server refers to the server-side component. This consists of pages that can be interpreted by the server, hence the term Active Server Pages.

4 ASP Vs HTML  ASP files combine HTML, scripts, and ASP code to enable a much higher degree of interactivity than is possible with plain HTML.  With ASP, programmers working on Windows NT can tailor the way pages are displayed based on outside information.A different image could be displayed each day of the week, or information could be displayed based on a user's age. This process, which is called condition branching, allows ASP to make decisions about what to display based on certain criteria.  HTML, on the other hand, has no way to make this type of decision.  It's a display language. In the real world, you'll probably want to interact with users through a web storefront or personalize their experience by offering tailored content. For this, branching or the ability to make decisions is needed.

5 The Differences between Active Server Pages and Conventional HTML:  HTML is static.  The user types in a Web address and the browser sends a request for the Web page to a Web server. The Web server receives the request and retrieves the appropriate HTML file from a disk or memory and transmits it back to the browser. The user's Web browser translates the HTML file and the results are displayed in the browser window. The results are static as long as the underlying HTML page is unchanged.  Static Web pages are used when information is not expected to change much over time.  Static Web pages are ideal for home pages or sites where content is not going to be modified frequently. In order to make changes to static Web pages, one must edit the HTML file.  ASP is dynamic.  Both work in the same way. One major difference with ASP is that it is dynamic.  In ASP, scripting code runs on the server and produces HTML output, which is then sent to the browser for display. When a browser requests an ASP file from the Web server, the ASP interpreter reads through the ASP file, executes any of the ASP commands in it and sends the resulting HTML to the browser. This means that the same ASP page might produce HTML that appears in the browser differently each time it is requested.  An ASP file can contain any combination of HTML and script.  Since ASP pages produce standard HTML, they require no specific browser.

6 Difference between JSP and ASP :  The Java 2 Enterprise Edition (J2EE) architecture looked like the best way to develop multi-tiered applications. Java Server Pages (JSP) and servlets had many advantages over the Active Server Pages (ASP) and Common Object Model (COM+) platforms.  Microsoft.Net is providing a similar platform but with more functionality, and it quite possibly could have the foundation for being cross-platform at some stage. According to Sun, JSP is better than ASP for the following reasons: It has platform and server independence, it has extensible JSP tags and ASP is interpreted. ASP.Net changes all of this.  Java is superior for it is a cross-platform environment. Drawbacks: Java is slow by design. With Java, every time you run your program it goes through the Java Virtual Machine, an interpreter, which then converts the Java byte codes to native code.  Microsoft may end up having support for platform independence with the way programs are compiled with Microsoft.Net.

7  When a program is compiled with.Net, it is compiled into a DLL or EXE in Microsoft Intermediate Language (MSIL) format, a processor independent assembly language. MSIL does not contain any dependencies on any particular operating system or architecture. The first time this EXE is executed, it uses Just In Time (JIT) compilation to convert the MSIL into native code. So the first time you run it, it may be slower, but subsequent executions will be faster. This has the potential for adaptation to a cross-platform situation, but Microsoft hasn't made any promises of that yet.  Now, if Microsoft will ever actually convert.Net to work on other platforms, but they are putting the support in there for it.  Of tags and scripts ASP 3.0 does not have extensible tags, an advantage that JSP has held over ASP for quite some time. Now with ASP.Net, extensible tags are available. Through the use of Web Forms, ASP.Net is able to do data binding, form validation and more without the developer having to write any script at all. Developers even have the ability to write their own custom Web Form controls to suit their own needs.

8  ASP was an interpreted language, whereas JSP pages are compiled into servlets the first time the JSP page is accessed.  What Sun neglects to mention is that the servlet is still interpreted with the Java Virtual Machine.  With ASP.Net, pages will now be precompiled to MSIL and then use JIT compiling, just like JSP.  The difference is.Net gets compiled once into native code, and servlets are interpreted every time they are executed. In the long run,the result in.Net code will be more efficient.  Microsoft's.Net may not be perfect. Since it still is in beta, it may change quite a bit before it is actually released. However, it is a great alternative.  In the past, using COM and the Microsoft Transaction Server (MTS) was a nightmare for developers and using J2EE was slower than death. For a long time, the J2EE platform was superior to ASP and COM+. With.Net coming soon, Sun should be looking for new ways to improve its platform and remain competitive. Otherwise, it may be losing future developers.

9 Overview ASP is a server-side scripting environment that you can use to create and run dynamic, interactive, high-performance Web server applications.

10 What Are Active Server Pages? Active Server Pages (ASPs) are Web pages that contain server-side scripts in addition to the usual mixture of text and HTML (Hypertext Markup Language) tags. Server-side scripts are special commands you put in Web pages that are processed before the pages are sent from your Personal Web Server to the Web browser of someone who's visiting your Web site.  When you type a URL in the Address box or click a link on a Web page, you're asking a Web server on a computer somewhere to send a file to the Web browser (sometimes called a "client") on your computer. If that file is a normal HTML file, it looks exactly the same when your Web browser receives it as it did before the Web server sent it. After receiving the file, your Web browser displays its contents as a combination of text, images, and sounds.  In the case of an Active Server Page, the process is similar, except there's an extra processing step that takes place just before the Web server sends the file. Before the Web server sends the Active Server Page to the Web browser, it runs all server-side scripts contained in the page. Some of these scripts display the current date, time, and other information. Others process information the user has just typed into a form, such as a page in the Web site's guest book.  To distinguish them from normal HTML pages, Active Server Pages are given the ".asp" extension.

11 What Can You Do with Active Server Pages? There are many things you can do with Active Server Pages.  You can display date, time, and other information in different ways.  You can make a survey form and ask people who visit your site to fill it out, send emails, save the information to a file, etc What Do Active Server Pages Look Like? To the Web browser that receives it, an Active Server Page looks just like a normal HTML page. If a visitor to your Web site views the source code of an Active Server Page, that's what they see: a normal HTML page. However, the file located in the server looks very different. In addition to text and HTML tags, you also see server-side scripts. This is what the Active Server Page looks like to the Web server before it is processed and sent in response to a request. What Do Server-Side Scripts Look Like? Server-side scripts look a lot like HTML tags. However, instead of starting and ending with lesser-than ( ) brackets, they typically start with. The is called a closing tag. In between these tags are the server-side scripts. You can insert server-side scripts anywhere in your Web page--even inside HTML tags.

12 Important Underlying Object Model Concepts  The ASP object model employs Microsoft's concept of classes, collections, and properties.  Collections hierarchically organize groups of variables or properties associated with a class.  Multiple collections may be associated with each class of object. You can create neither your own classes nor collections in VBScript.  Finally, the current ASP development environment does not include an IDE or debugger. The Request Object  The request object provides any information passed through an HTTP request and is primarily used for reading information such as CGI variables, parameters passed through the GET and POST methods, cookies, and client certificates.  The HTTP_USER_AGENT variable, for example, is found in the request object's ServerVariables collection. The code szBrowserName = Request.ServerVariables("HTTP_USER_AGENT”) stores the value of HTTP_USER_AGENT in the szBrowserName variable.

13 The Response Object  The response object is used to create output that is returned to the user. Because it is used primarily for writing information, more methods are associated with it.  The sample code demonstrates using the Response and Request objects.  It includes both a simple HTML form and an ASP program file that processes and displays the form's output; the form calls itself recursively. The Application Object  An application is a group of related files stored in an IIS virtual directory and shared by all application users.  It is instantiated when the first user requests an ASP file in the application's directory structure after the Web server has been started. Applications end when the server shuts down. You can write code to respond to application start and end events, and also attach your own variables to the application object, making them accessible to all application users.  Query results, for example, can be stored at a global level that any user can access.

14 The Session Object  The session object is similar to the application object, but belongs to a single user. It is instantiated for each application user when either: a user who doesn't already have a session requests an ASP file, an ASP program stores a value in the session object, or a user requests a page containing an object scoped at the session level.  Sessions end when the user doesn't read or refresh a page in an application for a specified amount of time. Sessions can also be explicitly terminated with the Session.Abandon method.  Like the application object, the session object is very powerful.  It maintains the state of the application as a user moves throughout the application's pages.  The session is maintained by a unique SessionID, stored in the user's browser.  Drawback: it relies on cookies, and can't be used with browsers that don't support them. That leaves you instead with URL query strings, hidden form fields, database records.  ActiveX Server Components  Unlike the session, application, response, and request objects, ActiveX server components (which act like objects) must be explicitly instantiated in your ASP programs.  The syntax for instantiating other objects is:. You then use the instance of the object, MyObject, in the rest of your program. OBJECTNAME is replaced with the name of an object or component. For eg: MSWC.BrowserType.

15 Components and Objects  Components and objects are the tools used to communicate with the server's environment and system.  A component can contain one or more objects.  An object can have one or more methods and one or more properties.  By creating an instance of an object, you can use its methods to perform tasks.  Changing an object's properties will cause its methods to perform tasks differently.  Several objects are built into ASP, some are built into VBScript, and some are built into the server's system.  Other components can be created to further customize an application.

16 Object or component FunctionSource Request Object Handles info coming from the browser Built into ASP Response Handles info sent back to the browser Built into ASP Server Object Provides access to some basic server services Built into ASP Application Object Maintains info for the life of an app. Built into ASP Session Object Maintains info for the life of a session Built into ASP Text Object Manipulates text files VBScript Scripting Object Error Object Provides for error analysis VBScript Scripting Object Dictionary Object Creates a lookup reference VBScript Scripting Object File System Object Provide access to file system VBScript Scripting Object Content Linking Imparts an order to the pages on a site Server Component Browser Capabilities Specifies what a user's browser can do Server Component Ad Rotator Rotates several ads in a spot on the page Server Component Voting Collects information from a user poll Server Component Active Database Provides communication with a database Server Component

17 Embedding ASP into your HTML document: ASP commands embedded in HTML code are executed on the server side rather than being sent to the requesting browser for execution. <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"& My first ASP Page This is an example of a simple ASP file. Note the two code fragments in the above text. This syntax indicates ASP commands that are interpreted at the server instead of being passed to the client. The first line tells the ASP engine to process the script using the VBScript interpreter. The second line of code,, instructs the ASP engine to output the current date and time to the client's browser.

18 Active Server Pages – Objects: The seven built-in objects are:  · ApplicationApplication  · ASPErrorASPError  · ObjectContextObjectContext  · RequestRequest  · ResponseResponse  · ServerServer  · SessionSession  Component Object Model (COM) created a standard communication mechanism between components.  The most important new feature of version 3.0 is the addition of a seventh, intrinsic object called ASPError which should greatly simplify error handling. Other new features include the addition of three new methods to the Server object, and two new methods to both the Application object and the Session object.

19 Example A basic format of the ASP tag is as below. Date,Time, and Display WELCOME TO SO & SO ‘s ACTIVE SERVER PAGES !!! The time is Today's date is YOUR BROWSER TYPE IS

20 Simple ASP Coding  When a browser sends a request to the server for an ASP page, the server interprets the ASP before it is sent out. Your page could have text that says "good morning" when a client visits your site before noon, text that says " good afternoon" to another client who first visits your site after noon, and "good evening" to the client who visits your site after the workday is over. In other words, your page is being created on the fly: it could be different each time the client sees your page.  When writing an ASP, it is differentiate between ASP code and HTML by identifying or by the script tag : which are known as delimiter tags. Simply place your code between the delimiters.  By default, ASP assumes the use of VBScript.  Other scripting engines such as JavaScript can be used.

21 Let's look at a few examples of simple ASP coding.  To display the time you would insert into your HTML page. Display the time: Your browser should display the current time. Date and Time are VBScript functions. Displaying the date follows the same convention.  We can even produce the actual day by using a slightly more complex If Then or Select Case structure. Below is an example of displaying the current day of the week by using the If Then or Select Case structure. Date and Time <%

22 Dim dtmCurrent, intWeekDay, strWeekDay dtmCurrent = Date intWeekDay = WeekDay(dtmCurrent) Select Case intWeekDay Case 1 strWeekDay = "Sunday" Case 2 strWeekDay = "Monday" Case 3 strWeekDay = "Tuesday" Case 4 strWeekDay = "Wednesday" Case 5 strWeekDay = "Thursday" Case 6 strWeekDay = "Friday" Case 7 strWeekDay = "Saturday" Case Else strWeekDay = "Something obviously went wrong!" End Select %> Today is  In general, sends the value of the expression to the browser or by using the syntax: Response.Write("your statement here") For example: ") Response.Write("Hi There") %>

23 produces the output "Hello" followed by "Hi There" on the next line.  The server is interpreting all statements between the delimiter tags before the client sees the page.  Response.write tells the server to write its arguments directly to the HTML page being created. Therefore, response.write("Hello" & " ") places Hello in the HTML file. This, of course, produces a line break after the "Hello" when the HTML is displayed in the browser. Although is a tag recognized in HTML as a line break, ASP does not recognize.  HTML is interpreted by the browser and ASP is, as stated earlier, interpreted by the server.  Response is one of seven intrinsic ASP objects.  There are numerous other scripting languages available besides VBScript. We can specify which script language to use by For example: Display the date and time:

24 Development Environment The ASP Application-Development Framework  The ASP application-development framework includes a number of objects  the request object,  the response object,  the application object,  the session object and  the server object.  These objects have properties, events and methods through which programmatically control the application.  The request object is used primarily to manage data relating to HTTP requests.  The response object is used to control the HTML output, which is returned to the user.  The session object is used to manage session-level data for individual users.  The application object is used to manage a multiuser Web-based application.  The server object is a bit different. It enables you to instantiate ActiveX server components.  In typical ASP applications, server-side ActiveX components provide a lot of the functionality.

25  Microsoft provides several ActiveX server components that can be used in ASP applications.  The database-access component, the browser-capabilities component, and the file-access component are of the greatest utilitarian value.  Microsoft also provides a content-linking component (that helps manage user navigation through a Web application) and an ad-rotator component (which enables you to alternate the display of images, typically used for advertisements, according to your specifications).  There is also a flourishing market for third-party components.  And of course, you can create your own components as well, though this is a job for seasoned VB and C++ developers.  The ASP object model employs Microsoft's concept of classes, collections, and properties Collections hierarchically organize groups of variables or properties associated with a class. Multiple collections may be associated with each class of object.  The current ASP development environment does not include an IDE or debugger.

26 Advantages and disadvantages  Earlier most Web sites were created with HTML and simply displayed static pages.  A few of the more adventurous programmers would use C or Perl to design a dynamic Web site utilizing the CGI technology. However, these techniques were plagued with security concerns and did not scale well to large sites.  Dynamic sites remained relatively few in number and were time consuming and expensive to create.The introduction of the scripting languages, which could be embedded inside HTML code, opened new doors for dynamic site development.  Active Server Pages (ASP), which managed to arrive just in time for the explosive growth of the World Wide Web, was a next logical step for Web-based application development.  Active Server Pages proved to be an exciting, new technology that extended standard HTML by adding built-in objects, server-side scripts, access to databases, and ActiveX components.

27  The ASP scripting environment is compliant with the Component Object Model (COM). COM created a standard communication mechanism between components. This step allowed non-vendor components, to share their properties, methods and events with other components in a process called OLE automation. Non-vendor components greatly extend the functionality of ASP applications.  The true power of ASP is the ease and rapidity with which developers can create and implement dynamic Web sites.  ASP employs a scripting environment and VBScript is the default scripting language of choice. However, you can use other languages (such as JScript and Perl) as long as they have a scripting engine that is compatible with the ActiveX scripting standard.  ASP is not limited with Microsoft's Internet Information Server (IIS) and this has enhanced the popularity of ASP. For example, Chili!Soft is a proven industry leader in providing ASP engines for use with Web servers from FastTrack, Lotus, Netscape, O'Reilly, and many others. And Halcyon Software offers a brilliant Java- based implementation of the Microsoft ASP framework, allowing developers to deploy ASP applications on any platform.

28  Added functionality: ASP version 3.0. Version 3.0 was released along with Internet Information Server (IIS) version 5.0 as part of the highly anticipated Microsoft Windows 2000. The addition of a seventh, intrinsic object called ASPEerror which should greatly simplify error handling as made ASP easy. Other new features include the addition of three new methods to the Server object, and two new methods to both the Application object and the Session object.  Active Server Pages has ultimately proven to be of significant value to developers and fueled a revolution in the development of Web-based applications.  The future of ASP will continue to be very interesting with the upcoming ASP-plus, which is now referred to as ASP.NET.  It allows the use of the Visual Basic, C#, and Visual C++ languages with ASP.

29 Disadvantages: Potential Drawbacks  ASP is a powerful tool for dynamic web content, but like other solutions, it does have some drawbacks.  ASP is only available for Windows (NT and 95). It has traditionally required that you be running a Microsoft web server (generally Internet Information Server), though that may change with a product called ChiliASP, which is marketed as ASP for other servers.  ASP also uses cookies, which means people using the Lynx browser can't access pages.  ASP does have competition, mainly from a product called Cold Fusion. Cold Fusion, made by Allaire, will also let you talk to databases such as an Access file or SQL Server. However, Cold Fusion's tags can be very confusing and difficult to debug, and some people report memory leaks.  In a nutshell Pros: Quick Cons: Does not scale. Does not live through reboots because it lives in RAM.

30 Utility in ecommerce ASP can be used for this:  Store and get information from a database from the Internet.  Make your webpages more interactive for your visitors. A golden example of this is for example, show the current date and time at your page when anyone visits it.  Make your pages more personal, by letting the visitor choose the Fonts and size he wants on the page.  Store information about a visitor which can be used every time that visitor comes back. And because of that remind him about something or show him his personal settings for your page.  Make games, Guest books, Advertisements, Create and read cookie information etc.

31 Usage in Projects  The big corporations like Microsoft, Dell are already using ASP in their web strategies. In the future with release Microsoft. NET, ASP Plus is going to have a big wave in the IT industry.

32 Future Trends Actively Serving the World: The Future of ASP As ASP becomes more popular, its dependence on Windows can only be seen as limiting. But this is about to change.  XML can be used for more purposes than HTML coders may have ever imagined. Microsoft have not wasted any time integrating it within their applications. IE 5 has been able to parse XML from its inception (just point your IE 5 browser to an XML file and it will display it all nice and color tagged), and talks that Microsoft's future.NET platform will make use of XML even more than any tool does today.  Both ASP+, ADO+, among others, will use XML to define and present data.  The message from Microsoft is quite simple: if you are comfortable with XML today, you will soon be ready to develop applications in the revolutionary platform called Microsoft.NET.

33  If ASP+ and XML are destined for each other, it seems likely that Active Server Pages will also become more popular as a web framework.  At least, this is what various software companies hoping to crack the e- commerce economy believe, resulting in a flux of third-party tools to let you run ASPs on operating systems other than Windows.  Microsoft's introduction of ASP paralleled application development in general taking a server-side, thin client focus. Hence, a cross-platform ASP product made very good sense.  ChiliSoft was the first to introduce such a server in 1997. One of the more recent incarnations is Instant ASP, produced by Halcyon Software with same promise of running ASPs on any platform of the programmer's liking.  About the alternatives to ASP frameworks like cold fusion, most companies agree that not only is ASP easiest to use, it comes free with the OS and supports many development tools.

34  Economic Factors  For most software companies, improvements in tools like ASP and XML reflect much larger economic trends.  Consistent growth over the last five years in the gross domestic product (GDP) a number averaging 4% per annum — is usually linked to two important development factors: outsourcing and technology. Here productivity becomes coincident with the single trend of generating more goods and services with less effort and at lower costs.  ASP fits well in this economy.  Tools like ASP and XML, these companies maintain, will be key to the growth of the global economy over the next decade.

35 http://msdn.microsoft.com/workshop/server/asp/aspatoz.asp http://www.webmonkey.com http://www.programmingtutorials.com http://www.devcentral.com http://www.ahref.com http://www.activeserverpages.com http://www.15seconds.com http://webknowhow.net http://www.zdnet.com http://dmoz.org http://www.submitside.com http://www.tutorialhound.com http://www.webtechniques.com Reference

36 http://www.planet-source-code.com http://www.advantage.co.nz http://4guysfromrolla.aspin.com http://www.devguru.com http://www.AspFree.comhttp://www.AspFree.com http://www.4guysfromRolla.com http://www.CoverYourAsp.com http://www.aspalliance.com http://www.aspin.com http://www.4guysfromRolla.com http://www.CoverYourAsp.com http://www.aspalliance.com http://www.aspin.com http://www.haneng.com http://www.findtutorials.com http://www.aspsamples.com http://asp.papiez.com


Download ppt "Active Server Pages Submitted to Dr. Virginia F. Kleist Submitted by Soundar Nadarajan."

Similar presentations


Ads by Google