Posted by : Unknown Saturday, June 29, 2013


INTRODUCTION


These are components that allow web developers to create server-side scripted templates that generate dynamic, interactive web server applications. By embedding special programmatic codes in standard HTML pages, a user can access data in a database, interact with page objects such as Active-X or Java components, or create other types of dynamic output. The HTML output by an Active Server Page is totally browser independent, which means that it can be read equally well by Microsoft Explorer, Netscape Navigator, or most other browsers. The code for this scripting can be written in any of several languages, and is embedded in special tags inside the otherwise normal HTML code making up a page of content.

The Static Internet

The web server did not dynamically generate any part of the sites contents but simply served requests for static HTML pages loaded from the web server's file system and sent to the requesting client.

The Dynamic Internet

Ø CGI Applications (Common Gateway Interfaces)
It provides a mechanism by which a web browser can communicate a request for the execution of an application on the web server. The result of this application is converted/formatted into a browser readable (HTML) form and sent to the requesting browser.

Ø ISAPI Applications (Internet Server Application Programming Interface)
In CGI applications the web server has to instantiate a new application every time a request in made.  In ISAPI, to relay this problem having the DLL (Dynamic Link Libraries).  Once the ISAPI application DLL is loaded into memory, it stays in memory.  The web server does not need to load it again.

           In addition to ISAPI applications, ISAPI allows for the development of ISAPI filters. An ISAPI filter is a custom DLL that is in the same memory space as the web server and is called by the web server in response to every HTTP request, and it instructs the web server how to handle the request.  A security layer between the client and the web server it provides page-level security.
  
Active Server Pages

Late in the life of IIS2.0 (Internet Information Server) Microsoft began public beta testing of a technology whose code name was Denali.  This technology is now known as Active Server Pages.


ASP: A demonstration

An example of processing server-side script.

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<TITLE>Sample ASP</TITLE>
</HEAD>
<BODY>
Good afternoon. <BR>
Welcome to the sample.  It is now approximately
<%=Time()%> at the server.  Here are a couple of
demonstrations:<BR><BR><BR>
Some simple text formatting done using HTML:<BR>
<FONT SIZE = 1>Hello Size 1</FONT><BR>
<FONT SIZE = 2>Hello Size 2</FONT><BR>
<FONT SIZE = 3>Hello Size 3</FONT><BR>
<FONT SIZE = 4>Hello Size 4</FONT><BR>
<FONT SIZE = 5>Hello Size 5</FONT><BR>
<BR>
The same text formatting using server-side code:<BR>
<%
For intCounter = 1 to 5
%>
<FONT SIZE = <%=intCounter%>>
Hello Size <%=intCounter%></FONT><BR>
<%
Next
%>
<BR>
</BODY>
</HTML>

The server accepted the request, ASP.DLL interrupted and executed the server side script and created HTML.  The HTML is sent to the client, where it appears indistinguishable from straight HTML code.



The ASP Object Model

ASP encapsulates the properties and methods of the following.  Application, object context, request, response, server, session objects.

Ø Application object is an ASP application itself.
Ø Object context object is a part of the Microsoft Transaction Server and is only interfaced through ASP.
Ø Request object represents the way you interact with the clients HTTP request.
Ø Response object represents your access/control over the HTTP response sent back to the user.
Ø Server object gives you access to the web server itself.
Ø Session object holds information that is unique to a specific user's current session on the web server

  
ACTIVE SERVER PAGES

Scripting languages are used to develop interactive web pages. Live script is a script language developed by the NetScape communications along with the Sun Microsystems. It consists of limited programming instructions that reside in the web pages viewed using the NetScape Navigator browser on the client machine.  The main aim of this scripting language is to solve the dynamic web application problems.  The marketing demand on surrounding Java, the LiveScript was quickly renamed to JavaScript.  With this JavaScript, you could build forms and mortgage calculators and all sorts of interactive web pages. The draw back for this scripting language had the scripting host.

VBScript is developed by the Microsoft for its own. VBScript means Visual Basic, Scripting Edition.  The syntax of the JavaScript is similar to the Java, but the syntax of the VBScript is same as Visual Basic.

Client-side Scripting

How to include scripting code in the web pages that are viewed by your users. How the browser recognizes the script is all script is surrounded by matching <SCRIPT></SCRIPT> tags. The most famous client-side scripting languages JavaScript, VBScripting, PerlScript.
The difference between these script languages are shown below:

<SCRIPT LANGUAGE="JavaScript">
<!--
Function AlertJS()
{
          alert("Hello world.")
}
-->
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
<!--
Sub AlertVBS()
MsgBox "Hello world."
End Sub
-->
</SCRIPT>

<SCRIPT LANGUAGE="PerlScript">
<!--
Sub AlertPS()
{
          $window->alert("Hello world.");
}
-->
</SCRIPT>

In the above example <!-- and -- > are the HTML comment symbols.

Server-Side Scripting

Now we will learn how to bring the power of scripting to the server and harness it to dynamically create HTML in reaction to user requests. The server side scripting pages files having the file extension of  .ASP, whenever the browser makes a request for a file ending with the .ASP file extension, IIS knows to bring ASP.DLL  into play to interpreted the result of this code are placed into the document, which is a simple HTML document before it is sent to the user.
How does the ASP.DLL know which code to interpret  the answer to this question is the ASP.DLL interprets all code in a file that's delimited with <%......%> as being ASP code. We can dynamically construct not only HTML content but also client-side script code.
Example of this dynamic form of ASP file is shown here
          <HTML>
          <HEAD><TITLE>Example </TITLE>
          <BODY>
                   Welcome to dynamic form.
          <%
                   intCmdCount=Request.QueryString("button_count")
          if cmdCount<1 then
                   intCmdCount =1
          Endif
                   if int CmdCOunt>10 then
                             intCmdCount=10
          Endif
          For intCounter=1 to intCmdCount
          %>
<INPUT TYPE=button VALUE =Button<%=intCounter%>
onClick="Button<%=int Counter%>-Click()
<%
Next
%>
<SCRIPT LANGUAGE="VBScript">
<%
For intCounter=1 to intCmdCount
%>
Sub Button<%=intCounter%>-Click()
MsgBox "You just clicked button <%=intCounter%>
EndSub
<%
Next
%>
</SCRIPT>
</BODY>
          </HTML

ASPFunctions

Code reuse is as important in Active Server Pages as it is in any other form of application programming. It is possible  with RUNAT attribute of the <SCRIPT> tag.

Extending Active Server Pages


Extending Active Server Pages applications usually takes the form of instantiating sever side objects that expose methods and properties that you can access through your server side code. Once instantiated, a browser capabilities object allows you to discern details about the user's web browser: what scripting  is supports, what platform it is running on, and so on. This component allows you to dynamically alter your site in response to the presence or absence of certain browsers. The following table gives the list of server components discussed in ASP nutshell.
                            

Server Component
Description
ADO
Adds database access to Active Server Pages Application.
Browser Capabilities
Easily determines the functionality supported by your user's web browser
Collaboration Data Objects for NTS
Adds messaging functionality to web applications. Using the objects that make up CDONTS, you can create robust, mail enabled group ware applications using ASP. Although it is a powerful extension to ASP
Content Linking
Maintains a linked list of static content files. From within these files, the content linking component allows you to set up easy-to-use navigation from one page  to next page.
Content Rotator
Creates a schedule file containing several pieces of HTML that are alternately placed in your web site. This component is similar to the AdRotator component but works with straight HTML content rather than advertisements.
Counters
Maintains a collection of counters, over the scope of an entire ASP application that can be incremented or decremented from any where in your web site.
File Access Components
Allows you to access your local and network file system. It's part of the scripting runtime library that's installed and registered by default when you install IIS.
MyInfo
Maintains commonly accessed information, such as the web master's name, address, company, etc., from with your web application.
Page Counter
Creates a page counter on any page on your web site .the page count is saved regularly to a text file. This allows you to maintain page count information even if the web server is restarted.
Permission Checker
Checks the permissions on a given resource on the local machine or the network. This allows you to determine on the fly whether the current user has permission to see a file.
Although IIS comes with several server components, you also can write your own in any development language that can create COM objects.

ASP Object Model


You can share information among all clients of a given ASP application using the application object this built-in object represents the ASP application itself and is the same regardless of the number or type of clients accessing the application and regardless of what part or parts of the application those clients are requesting.

The application objects initialization occurs when the first user of your application requests any file from within the virtual directory that the ASSP application encompasses. This initialization can be thought of as setting aside memory for the given ASP application. The web browser instances and initializes the application object for you. However, you can customize this initialization by including code in a special optional file called GLOBAL.ASA.

Application Objects
                  
          The GLOBAL.ASA file provides a place for you to create variables and objects that have application level scope.

                 Application Object Summary
Properties
     None.
Collections
     Contents
      StaticObjects
Methods
      Lock
      Unlock
Events
      Onstart
       Onend





Collections References:

Contents Collection
Syntax: Application.Contents(key)

The content collection contains all the application level scoped variables  and objects added to the current application through the use of scripts.

StaticObjects
                   Syntax: Application.StaticObjects(key)
         
          The Static Objects collection contains all of the objects added to the application through the use of the <OBJECT> tag.

Methods References:

Lock
                   Syntax: Application.Lock

The lock method locks the application object prevents any other client from altering any variables values in the contents collection.

Unlock
          Syntax:Application.Unlock

The unlock method is used to release the application object, so other clients can alter the contents collection variable values.

Events References:

OnEnd
          Syntax: Application_OnEnd

The OnEnd event is triggered when the ASP application itself is unloaded from the web server or when the application is inadvertently stopped for some reason.
OnStart
          Syntax: Application_OnStart

The OnStart event is triggered when the firsr client request is received.

Object Context Object

An important addition in Active Server Pages2.0 is the ability to create a transactional script: one whose constituent code segments all, succeed completely or fail as a group. ASP application transactions are controlled by Microsoft Transaction Server (MTS).

                      Object Context Object Summary
Properties
      None
Collection
      None
Methods
       SetComplete
       SetAbort
Events
       OnTransactionCommit
       OnTransactionAbort


Method References:

SetAbort
                   Syntax: ObjectContext.SetAbort
Aborts the transaction as a whole. When it is called the transaction ends unsuccessfully, regardless of code that has or has not already been processed in your script.

SetComplete
          Syntax: ObjectComplete.SetComplete
Signals the successful completion of a transaction. When it is called the code in the OnTransactionCommit event procedure code is processed it is exists.
Events Reference:

OnTransactionAbort
          Syntax:OnTransactionAbort()

The OnTransactionAbort event procedure is processed immediately if the SetAbort method of the object context object is called explicitly in scripted code or by a server component called from the scripted code. If no code calls the SetAbort method, this event procedure is never processed.

OnTransactionCommit
          Syntax: OnTransactionCommit()

The OnTransactionCommit event procedure is processed immediately if the SetComplete method of the ObjectContext object is called explicitly if no script is in scripted code or by a server component called from the scripted code. It also is called implicitly if no script on the current page called SetAbort method.

Request Object

The properties, collection, methods and events of the ASP Request object is shown below:

                      Request Object Summary     
Properties
      TotalBytes
Collections
      ClientCertificate
      Cookies
       Form
       QueryString
       ServerVAriables
Methods
        BinaryRead
Events
        None


Properties References:

TotalBytes
          Syntax: var=Request.TotalBytes

The TotalBytes property is a read-only value that specifies the total number of bytes posted to the web server by the client in the HTTP request body.

Collections References:

ClientCertificate
          Syntax: Request.ClientCertificate

The ClientCertificate collection of the request object access to the certification fields of the client's digital certificate. ClientCertificates are sent to the web server when a client's browser supports the Secure Socket Layer.

Cookies
          Syntax: Request.Cookies
                  
          A Cookie is a small bit of information that is stored for a set period of time on the client machine, and is stored as a named value and keyed by the ASP application path.

Form
                   Syntax: Request.Form

Form contains name-value pairs sent from a form using the POST form posting method. Each for element becomes one entry in the form collection.

QueryString
          Syntax: Request.QueryString(variable)[(index)| .Count]
                  
          QueryString contains name-value pairs sent using the form's GET posting method or appended to the end of the URL used to reference the ASP page. Each name value pair becomes one entry in the QueryStringCollection.
ServerVariables
          Syntax: var=Request.ServerVariables(key)

The ServerVariables collection contains several predefined environment variables in the context of the client's specific HTTP request of the web server.

Methods References:

BinaryRead
          Syntax: MySafeArray=Request.BinaryRead(ByteCount)

Here MySafeArray is used to store the information ByteCount  is the number of bytes read using the BinaryRead method.

Response object

A response is output to a client from the server, and response object is used to send this information.

                      Response Object Summary
Properties
      Buffer
      CacheControl
      Charset
      ContentType
      Expires
      ExpairsAbsolute
      IsClientConnected
      PICS
      Status
Collections
      Cookies
Methods
       AddHeader
       AppendToLog
       BinaryWrite
       Clear
       End
       Flush
       Redirect
      Write
Events
       None


Properties References:

Buffer
                   Syntax: Response.Buffer[=flag]

A flag to determine whether Response output is buffered until the server script is finished processing or until a forced buffer output.

CacheControl
          Syntax: Response.CacheControl[=Cache Control Header]

A flag to determine whether proxy servers can cache ASP generated output.

CharSet
          Syntax: Response.CharSet(Charsetname)

                   It is an HTTP response character set

ContentType
                   Syntax: Response.ContentType[=strCharsetName]

                   The HTTP ContentType; text/HTML by default.

Expires
Syntax: Response.Expires[=number]

                   It gives minutes before the Asp page content is expired.

ExpiresAbsolute
          Syntax: Reponse.ExpiresAbsolute[=[Date][Time]]

                   A specific date and time when the cached page contents are expired.
IsClientConnected
          Syntax: Response.IsClientConnected

                   Whether the client is connected after the last response.

PICS
          Syntax: Response.PICS(PICSLabel)

PICS is a rating system used voluntarily by site’s to rate the adult nature of content within the site.

Collections References:

Cookies
          Syntax: Response.Cookies.Item(key)=strCookieValue.

Methods References:

Add Header
Syntax: Response.AddHeader Name, Value
                  
Adds an HTML header to the response.

AppendToLog
Syntax: Response.AppendToLog string

         Appends a String of up to 80 characters, not including any commas, to the log file for the response.

BinaryWrite       
Syntax: Response.BinaryWrite data

Writes data to out put with out any character conversion.

Clear
Syntax: Response.Clear

Clears the current buffered contents.

End
Syntax: Response.End

Ends server script processing and forces out put of buffered contents .

Flush
Syntax: Response.Flush

Forces out put of buffered contents and ends keep-alive requests for the page.

Redirect
Syntax: Response.Redirect URL

Redirects  the connection to a different URL.

Write
Syntax: Response.Write variant
Writes information directly to the HTTP response body.

Server Object

The server object is used to create instances of server component objects, which can the be used with in another component  or with in an ASP page.

                         Server Object Summary
Properties
      ScriptTimeout
Collections
      None
Methods
      CreateObject
      HTMLEncode
      Mappath
      URLEncode
Events
      None

Properties References:

ScriptTimeout
          Syntax: Server.ScriptTimeout [=NumSeconds]

                   The default time out value is 90 seconds.

Methods References:

CreateObject
          Syntax: SetObjMyObject=Server.CreateObject(ProgID)

Instances an object on a server.

HTMLEncode
                   Syntax: Server.HTMLEncode(string)
                  
          Takes a string as a parameter and returns the same string with HTML encoding.

MapPath
          Syntax: Server.MapPath(Path)
                            
Maps a virtual or relative path to a path relative to the directory of the ASP file being accessed.

URLEncode
          Syntax: Server.URLEncode(string)
                  
          Takes a string as a parameter and returns the same string with URL encoding.

Session Object

The session object manages object instances and variables at
the session level.



                      Session Object Summer 
Properties
      CodePage
      LCID
      Timeout
Collections
      Contents
      StaticObjects
Methods
      Abandon
Events
       Session-OnEnd
       Session-OnStart


Properties References:

CodePage
          Syntax: Session.CodePage(=CodePage)

                   Sets code page to be used for the ASP file.

LCID
Syntax: Session.LCID(=LCID)
         
LCID represents local identifier. This identifier is a standard local identifier used to display local-specific content.

SessionID
          Syntax: Session.SessionID

                   It uniquely identifies the current user's session.

TimeOut
          Syntax: Session.TimeOut(=nMinutes)

                   The specific time period that determines when the session ends.


Collections References:

Contents Collection
          Syntax: Session.Contents(key)
                  
          Contents all of the variables and objects added with session-level scope through script.

Static Objects
          Syntax: Session.StaticObjects(key)

Contains all of the objects with session level scope that are added to the application through the use of the <OBJECT> tag.

Methods References:

Abandon
          Syntax: Session.Abandon
                  
          Releases a memory used by the web server to maintain information about a given session.

CONCLUSION

MicroSoft created ASP in answer to the need for a scalable and efficient web server application technology, that is also relatively safe. ASP is fairly simple to use, and all of the applications can actually be created with server side script using languages like JavaScript/JScript or VBScript. If some functionality is needed that can’t be provided by scripting, ASP components can be used. ASP pages are created with a default extension of .ASP. When IIS gets a request for a page with an .ASP extension, the web browser access and compiles the script then script contained within the page and loads the compiled code into memory. The script then performs some processing, which usually generates HTML that is then written out to the ASP page.

{ 5 comments... read them below or Comment }

  1. Thanks for sharing useful information. I learned something new from your bog. Its very interesting and informative. keep updating. If you are looking for any Data science related information, please visit our website Data science training institute in btm layout

    ReplyDelete
  2. Such a wonderful post..
    Thanks for sharing with us,
    We are again come on your website,
    Thanks and good day,
    If you need any logo then,
    Please visit our site,
    buylogo

    ReplyDelete
  3. Hey everyone.
    We are giving you the big best offer to buy logo design for your business with 80% off I expect You will be happy with us.Logo Designers

    ReplyDelete
  4. when I visit this helpful content I realized that this is really useful for me thanks for sharing with us...!
    we design websites & logos with a guarantee also with a discount are you guys interested in?
    Logo Designers

    ReplyDelete

Blog Archive

- Copyright © Seminar Sparkz Inc -- Powered by Semianr Sparkz Inc - Designed by Shaik Chand -