Asp Material 01

  • Uploaded by: Abdulraheman
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Asp Material 01 as PDF for free.

More details

  • Words: 1,886
  • Pages: 11
Jatin Soni : 9904181899 : Hi Friends.

The root physical address determines the starting physical directory. For example, if you set the root physical address to C:\InetPub\wwwroot as shown in the Figure. The following virtual address http://yourServer/default.asp http://yourServer/datetime/CurrentTime.asp would translate to the following physical address C:\InetPub\wwwrootyour\default.asp C:\InetPub\wwwroot\datetime\CurrentTime.asp It is a convention to use InetPub\wwwroot as your Web’s root Figure: To edit the Web site’s properties, visit the Advance pane.

Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.



Setting Up Internet Information Server

Internet Information Server (IIS) is Microsoft’s professional Web server. The latest version of IIS is 5.0, which ships with Windows 2000.ASP 3.0 ships with IIS 5.0 and is installed automatically when IIS 5.0 is installed. If you are running Windows NT Server, you need to use IIS 4.0 IIS 4.0 can be found on the Windows NT Option Pack 4.0 

Using ASP Without IIS or PWS

Because Microsoft’s Web servers only run on the various Microsoft Windows products, you may think that if you want to use ASP pages, you must use IIS or PWS as your Web server. This is not the case, however, thanks to a couple of companies that have created software to allow ASP pages to run on various Web servers and platforms. One of these products in Halcyon Software’s Instant ASP, often abbreviated as iASP. Another such product, created by Chili!Soft, is Chili!ASP. These products can run on many non-IIS Web servers, such as the following: 

Apache



Sun Web Server



Java Web Server



Netscape Enterprise Server

These products can also run on a number of platforms, including 

Linux



Sun Solaris

Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends. 

Apple Mac OS



IBM/AIX

Creating ASP Pages To create ASP pages, you need access to a computer with a Web server that supports Active Server Pages technology. Microsoft Web Server: Personal Web Server and Internet Information Server. After you have a Web server installed, you can create ASP pages in your Web site’s root physical directory, or in subdirectories of the root physical directory, and view the result of these ASP pages through a standard Web browser. Because ASP pages are processed completely on the server-side and only return HTML to the client, any Web browser can be used to view ASP pages. There are no restrictions on the client-side. ASP pages, like regular HTML Web pages, are simply text files on the Web server. To create an ASP page, all you really need, after you’ve installed the Web server, is a text editor, such as Notepad. Creating an ASP page that displays the square roots of the numbers between 1 and 10. Listing: VBScript Code that Displays the Square Roots of the Numbers Between 1 and 10 1.<%@ Language=VBScript %> 2.<% Option Explicit %> 3. 4.

Square Roots


5.

<%

6.

Dim iLoop

7.

For iLoop = 1 to 10

Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.

8.

Response.Write iLoop & “ : ” & Sqr(iLoop) & “


9.

Next

10. %> 11. The code in Listing displays the square roots of the numbers between 1 and 10, inclusive. Line 1 starts the ASP code with the @LANGUAGE directive, Option Explicit statement – this requires that all variables used in the ASP page be explicitly defined. Lines 3 and 4 contain the embedded HTML code. The line 5 begins another ASP block, performing a For loop from 1 to 10. Line 8 displays both the current looping iteration and its square root. The Sqr function, which generates the square root of a number, Finally, lines 11 end the ASP page coding with more embedded HTML. Now that you’ve typed this code into Notepad, you need to save it as an ASP page. You would need to save the file as SquareRoot.asp and place it in your root physical directory. Recall that the root physical directory is specified by the Web Site’s Properties dialog and defaults to C:\InetPub\wwwroot. So, save the Notepad document in C:\InetPub\wwwroot (or whatever

your

root

physical

directory

is)

and

name

is

SquareRoot.asp. Now, open up your browser of choice and enter the following into the Address window: http://machineName/SquareRoot.asp. Your browser should then display SquareRoot.asp, whose output is shown in figure below. Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.

Figure: The Square Roots of first 10 natural numbers are displayed.

Tools For Developing/Writing ASP Code 

Notepad :- Creating ASP pages using Notepad has advantages and disadvantages. First, its advantages:  Speed – Notepad is a small, efficient text editor. However, you can create ASP pages with more advanced development tools. Although these tools have their own advantages, they require more disk space and memory and run slower than Notepad.

Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.

 Easy to use – Because Notepad doesn’t offer many options (after all, its sole purpose is to server as a text editor). You won’t find yourself reading help files. When compared to the advanced development tools of today, though, Notepad can seem lacking. Notepad’s disadvantages are usually based on its lack of options and include the following: 

No Web site maintenance – With Visual InterDev or Microsoft FrontPage, you can manage your entire Web site. With Notepad, you can only edit or create one file at a time.

 No color-coded syntax – When using FrontPage and InterDev different pieces of your code turn different colors. This makes it easier to check for syntax errors in both HTML tags and VBScript code  No drag-and-drop Web page creation tools – Both InterDev and FrontPage allow you to create the HTML aspects of a Web page by simply dragging and dropping certain objects and elements onto a Web page. With Notepad, you need to have a good understanding of the HTML tags you plan on using.

Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.



Using Visual InterDev :- Microsoft’s Visual InterDev servers as a unified development editor. InterDev is most commonly used, though, to manage Web sites. To manage a Web site with Visual InterDev, the Web site must have FrontPage Server Extensions installed. The files in your Web directory are shown in a tree control in the right-hand pane in Visual InterDev. You can double-click one of these files to edit it. Visual InterDev is a rich editing environment, one that allows you to easily develop ASP pages. Visual InterDev also adds a database application interface, which can be helpful when you start creating ASP pages that interact with databases

Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends. 

Using FrontPage :- As the popularity of the Web grew, several HTML editors came out. One of these editors was Microsoft’s FrontPage, a tool used by many Web developers to quickly build professional-looking Web pages. FrontPage focuses on creating HTML elements by allowing the user to simply type in the contents of the Web page and drag and drop in images and links to other Web pages. FrontPage removes the need to know HTML tags by heart. Although FrontPage may be useful for building HTML Web pages, it has shortcomings when using it to design ASP pages. You cannot simply drag and drop code, and because ASP pages contain scripting code, you cannot create the code for ASP pages as easily as you can create the HTML for a Web page. Despite this limitation, FrontPage is still often used to create Web pages. Developers use FrontPage’s GUI system to create the HTML for a Web page and then view the HTML source of the page created with FrontPage to add in the ASP code.

The ASP Project File : GLOBAL.ASA As you start building ASP applications, the GLOBAL.ASA file will play a central role in managing them. The .ASA file extension is an acronym for Active Server Applications. The GLOBAL.ASA file enables the management of two critical objects used to state information in an ASP application. The advent of ASP gives developers the ability to track user information from page to page within a Web-based application. This tracking capability is Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.

essential to implement any Web-based workflow application. When an application is first started, the GLOBAL.ASA file is loaded into memory. This file is used to track application events and individual user events, variables, and objects. The GLOBAL.ASA file is an optional file, located in the root directory of any ASP application, that relates directly to the Application and Session objects. It has two purposes: 

To define how the object events are handled.



To allow you to create component object instances with application or session scope.

The GLOBAL.ASA file must be named GLOBAL.ASA and must appear in the root directory of an ASP based application. Inside the GLOBAL.ASA file there are two containers, 

The object container



The script container <SCRIPT>

Code is contained in within the <SCRIPT> and tags, and object declaration are made between the and tags. The tag has the following attributes: Currently the only choice for the RUNAT attribute for both tags is SERVER. Scope is either Application Session. The identifier is the name assigned to the object created. The <SCRIPT> tag has the following attributes: <SCRIPT LANGUAGE = scriptlanguage RUNAT = Server> Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends.

ScriptLanguage can be any supported language. The Application and Session objects each have two events: 

OnStart



OnEnd

Object_Event

is

Application_OnStart,

Application_OnEnd,

Session_OnStart, or Session_OnEnd.

Application Events On start On end

Session Events On start On end

Figure: The GLOBAL.ASA file manages Application and Session objects.

The Firing Sequence if the GLOBAL.ASA File 

Application objects are created when the first user connects to an ASP-based application and requests a session.



When the Application object is created, the server looks for the GLOBAL.ASA

file.

If

this

file

exists,

the

script

for

the

Application_OnStart event is processed. 

The sub routine within the Session_OnStart is then executed. After which the .asp file that creates the HTML page is executed.

Jatin Soni : 9904181899 : Hi Friends.

Jatin Soni : 9904181899 : Hi Friends. 

Script in the GLOBAL.ASA file is executed before the page request that triggers the object creation is processed.



When the Session object times out or the Session.Abandon method is called, the Session_OnEnd event is triggered.



Code for the Session_OnEnd event in GLOBAL.ASA is processed before the Session Object is destroyed.



When the server shuts down, the Application_OnEnd event is triggered. All sessions are destroyed and all Session_OnEnd code is processed.



Code for the Application_OnEnd event is the GLOBAL.ASA file is then processed before the Application object is destroyed.

The whole file is really concerned with keeping track of how many sessions have been started on the server.

Jatin Soni : 9904181899 : Hi Friends.

Related Documents

Asp Material 01
May 2020 5
Asp Material 2
May 2020 13
Asp Material 3
May 2020 4
Asp Material 0
May 2020 12
Slide Asp 01
November 2019 22
Asp
November 2019 69

More Documents from ""