Your SlideShare is downloading. ×
  • Like
Active Server Page(ASP)
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Active Server Page(ASP)



Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • Steps involved in HTML page Processing are: A user enters request for Web Page in browser. The browser sends the request for the web page to web server such as IIS. The web server receives the request and recognizes that the request is for an HTML file by examining the extension of the requested file (.Html or .htm ) The Web Server retrieves the proper HTML file from disk or memory and sends the file back to the browser. The HTML file is interpreted by the user’s browser and the results are displayed in the browser window.
  • ASP page processing Steps: A user enters request for Web Page in browser. The browser sends the request for the web page to web server such as IIS. The web server receives the request and recognizes that the request is for an ASP file by examining the extension of the requested file (.asp) The Web Server retrieves the proper ASP file from disk or memory. The Web Server sends the file to a special program named ASP.dll The ASP file is processed from top to bottom and converted to a Standard HTML file by ASP.dll. The HTML file is sent back to the browser. The HTML file is interpreted by the user’s browser and the results are displayed in the browser window.
  • Client-side script runs on the Web Browser where Server-Side Script runs on the Web Server(in ASP file)
  • Output: My name is: Tripti Arora
  • Output:   Jan Egil Tove Hege Stale Kai Jim Borge
  • The example will set the Session variable username to Tripti and the Session variable age to 24. The line returns: "Welcome Tripti".


  • 1. Active Server Page (ASP)Presented ByKeshab Nath
  • 2. Introduction to ASP• What is ASP?– ASP stands for Active Server Pages.– ASP is a program that runs inside IIS.– IIS stands for Internet Information Services.– ASP is Microsoft’s solution to building advanced Web sites.
  • 3. Processing of an HTML PageRequestBrowser Web ServerMemory-HTML fileHTML FileWhen a browser requests an HTML file, the server returns the file
  • 4. Processing of an ASP PageRequestBrowser Web ServerMemory-ASP FileHTML File ProcessingWhen a browser requests an ASP file, IIS passes the request to theASP engine. The ASP engine reads the ASP file, line by line, andexecutes the scripts in the file. Finally, the ASP file is returned to thebrowser as plain HTML.
  • 5. Introduction to ASPASP page can consists of the following:– HTML tags.– Scripting Language (JavaScript/VBScript).– ASP Built-In Objects.– ActiveX Components eg. : ADO – ActiveX DataObjects.So, ASP is a standard HTML file with extendedadditional features.
  • 6. ASP Syntax– An ASP file normally contains HTML tags, just as astandard HTML file.– In addition, an ASP file can contain server sidescripts, surrounded by the delimiters <% and %>.Server side scripts are executed on the server, andcan contain any expressions, statements, procedures,or operators that are valid for the scripting languageyou use.– The response.write command is used to write output toa browser
  • 7. ASP Syntax• Scripts– Script is nothing but a set of commands that arewritten to perform a specific task– These commands are VBScript or JavaScriptcommands– There are two types of Scripts:• Client-Side Script : Runs On Browser (default : JavaScript)• Server-Side Script : Runs On Server (default : VBScript)– Scripts in an ASP file are executed on the server.
  • 8. ASP SyntaxScripts– Client-Side Script is embedded into the HTML file usingtags:<script language=“JavaScript/VbScript”>{JavaScript/Vbscript Code}</script>– Server-Side Script is embedded into the ASP file using tags:<script language=Vbscript/JavaScriptRunAt=SERVER>{Vbscript/JavaScript Code}</Script>OR<%@ Language = “VBScript/JavaScript” %><% {VBScript/JavaScript Code} %>
  • 9. Example<html><body><%response.write("Hello World!")%></body></html>
  • 10. ASP Variables• Variables– Variables are used to store information– This example demonstrates how to create a variable,assign a value to it, and insert the variable value into atext.<html><body><%Dim namename=“Tripti Arora"Response.Write("My name is: " & name)%></body></html>
  • 11. ASP Variables• Arrays– Arrays are used to store a series of related data items.– This example demonstrates how you can make an arraythat stores names.<%Dim name(5)name(0) = "Jan Egil"name(1) = "Tove"name(2) = "Hege"name(3) = "Stale"name(4) = "Kai Jim"name(5) = "Borge"For i = 0 to 5Response.Write(name(i) & "<br />")Next%></body></html>
  • 12. Including Files• The #include Directive– It is possible to insert the content of another fileinto an ASP file before the server executes it, withthe server side #include directive.– The #include directive is used to create functions,headers, footers, or elements that will be reused onmultiple pages.
  • 13. Including Files• How to Use the #include Directive– Here is a file called "mypage.asp":<html><body><h3>Words of Wisdom:</h3><p><!--#include file=""--></p><h3>The time is:</h3><p><!--#include file=""--></p></body></html>– Here is the "" file:"One should never increase, beyond what is necessary,the number of entities required to explain anything."– Here is the "" file:<%Response.Write(Time)%><!-- #include virtual="somefilename“ - ->Or<!--#include file ="somefilename"-->Syntax
  • 14. Including Files• Source code in a browser, it will look somethinglike this:<html><body><h3>Words of Wisdom:</h3><p>"One should never increase, beyond whatis necessary, the number of entitiesrequired to explain anything."</p><h3>The time is:</h3><p>11:33:42 AM</p></body></html>
  • 15. ASP Forms and User Input• User Input– To get information from forms, you can use theRequest Object– Example<form method="GET" action="tizagGet.asp">FirstName <input type="text" name=“fname"/>LastName <input type="text" name=“lname"/><input type="submit" /></form>– There are two ways to get form information: TheRequest.QueryString command and theRequest.Form command.
  • 16. • Request.QueryString– This collection is used to retrieve the values of thevariables in the HTTP query string.– The form data we want resides within the RequestObjects QueryString collection– Information sent from a form with the GET method isvisible to everybody (in the address field) and the GETmethod limits the amount of information to send.– If a user typed “Bill" and "Gates" in the form exampleabove, the url sent to the server would look like this: Object - Collections
  • 17. Request Object - CollectionsRequest.QueryString– The ASP file "pg.asp" contains the following script:<body>Welcome<%response.write(request.querystring("fname"))response.write(request.querystring("lname"))%></body>– The example above writes this into the body of adocument:Welcome Bill Gates
  • 18. Request Object - Collections• Request.Form– It is used to retrieve the values of form elementsposted to the HTTP request body, using the POSTmethod of the <Form> Tag.– Information sent from a form with the POST methodis invisible to others.– The POST method has no limits, you can send a largeamount of information.– If a user typed "Bill" and "Gates" in the form exampleabove, the url sent to the server would look like this:
  • 19. Request Object - Collections• Request.Form– The ASP file "pg.asp" contains the following script:<body>Welcome<%response.write(request.form("fname"))response.write("&nbsp;")response.write(request.form("lname"))%></body>– The example above writes this into the body of adocument:Welcome Bill Gates
  • 20. ASP Session• The Session Object– The Session object is used to store informationabout each user entering the Web-Site and areavailable to all pages in one application.– Common information stored in session variablesare user’s name, id, and preferences.– The server creates a new Session object for eachnew user, and destroys the Session object whenthe session expires or is abandoned or the userlogs out.
  • 21. ASP Session• Store and Retrieve Variable Values– The most important thing about the Sessionobject is that you can store variables in it, like this:<%Session("TimeVisited") = Time()Response.Write("You visited this site at:"&Session("TimeVisited"))%>Here we are creating two things actually: a key and a value. Abovewe created the key "TimeVisited" which we assigned the valuereturned by the Time() function.Display:You visited this site at: 8:26:38 AM
  • 22. Session Object - Properties• SessionID– The SessionID property is a unique identifier that isgenerated by the server when the session is firstcreated and persists throughout the time the userremains at your web site.– Syntax:<%Session.SessionID%>Example:<% Dim mySessionIDmySessionID = Session.SessionID%>
  • 23. ASP Cookies• Like ASP Sessions, ASP Cookies are used to store informationspecific to a visitor of your website. This cookie is stored tothe users computer for an extended amount of time. If you setthe expiration date of the cookie for some day in the future itwill remain their until that day unless manually deleted by theuser.• Creating an ASP cookie is exactly the same process ascreating an ASP Session. We must create a key/value pairwhere the key will be the name of our "created cookie". Thecreated cookie will store the value which contains the actualdata.
  • 24. Create Cookies<%create the cookieResponse.Cookies("brownies") = 13%>To get the information we have stored in the cookie wemust use the ASP Request Object that provides a nicemethod for retrieving cookies we have stored on theusers computer.
  • 25. Retrieving Cookies<%Dim myBrownieget the cookiemyBrownie = Request.Cookies("brownies")Response.Write("You ate " & myBrownie & "brownies")%>• Display:You ate 13 brownies
  • 26. THANK YOU