ASP Web Programming Class o Ravi Anand ASP
ASP – Web Programming Class o Ravi Anand
ASP – Active Server Pages What is ASP? - Microsoft Technology - Can Run using IIS/PWS/Others - Helps us create “dynamic” sites - HTML is static, ASP is dynamic - Ability to connect to web services, Databases, Server side components - Simple, Secure, Fast
ASP – Active Server Pages An ASP Page - Has a “. asp” extension - Can be edited using Notepad - Needs no compilation - Scripting typically done in vbscript - ASP pages are rendered as HTML pages - Also contains HTML, XML , client side scripts
ASP – Active Server Pages Running An ASP Page -On Your desktop -Install PWS on Windows 98 -Install IIS on 2000 /XP -On your “Server” -Typically 2003/ 2000 running IIS -All it needs is a webserver capable of running ASP
ASP – Active Server Pages An ASP Page <html> <body> <% Response. Write("Hello World!") %> </body> <html>
ASP – Active Server Pages ASP Scripting Languages -Default Scripting Language is vbscript - Can also use other scripting languages -such as javascript, PERL, etc - The script is executed on the server -Server should have the script Engine -Browser only gets an HTML ouput
ASP – Active Server Pages Creating an ASP PAGE (using vbscript) -Fundamentals -Variables -Loops -Conditional Statements
ASP – Active Server Pages Creating an ASP PAGE -2 -Scope – Application, Session , function/sub routine -Declaring a Variable <% dim x %> Refer Example 2 -Declaring Arrays Dim students(6) Refer Example 3
ASP – Active Server Pages Creating an ASP PAGE - 3 - Dynamic Content -Create HTML dynamically - Eg. Tables / Rows - Refer Example 4 , 5
ASP – Active Server Pages Creating an ASP PAGE - 4 -- Writing routines sub Add 2 Numbers(int 1 , int 2) response. write(int 1 + int 2) end sub
ASP – Active Server Pages Creating an ASP Form <form name=“” Action=“” METHOD=“POST|GET”> </form> Example 8 , 9
ASP – Active Server Pages Handling cookies --Write to a cookie --Reading from a cookie
ASP – Active Server Pages Response Object --Send output to the user from the server
ASP – Active Server Pages Request Object --Get information from the user
ASP – Active Server Pages Session Object --Store information related to a user session - E. g. Data Retrieved, Authentication , Error Information - Data that will be used across the Screens in the same session -Storing Info in a Session Variable -Session(“Account. Number")=“#ABCDE&^*1234" -Session(“Location")=“Macomb” -Retrieving info from a Session -Response. Write(Session(“Account. Number"))%>
ASP – Active Server Pages Application Object -To group the files in an application
ASP – Active Server Pages Server Object --To access properties and methods on the server.
ASP – Active Server Pages Error Object --Information of any error that occurs in scripts in an ASP page
ASP – Active Server Pages Global. asa <script language="vbscript" runat="server"> sub Application_On. Start 'some code end sub Sub Application_On. End 'some code end Sub sub Session_On. Start 'some code end sub Session_On. End 'some code end sub</script>
- Slides: 19