Title: ASP
1ASP Web Programming Class
2ASP Active Server Pages
What is ASP?
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
3ASP 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
4ASP 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
5ASP Active Server Pages
An ASP Page
lthtmlgt ltbodygt lt Response.Write("Hello World!")
gt lt/bodygt lthtmlgt
6ASP 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
7ASP Active Server Pages
Creating an ASP PAGE (using vbscript)
- Fundamentals
- Variables
- Loops
- Conditional Statements
8ASP Active Server Pages
Creating an ASP PAGE -2
- Scope Application, Session , function/sub
routine - Declaring a Variable
- lt dim x gt
- Refer Example 2
- Declaring Arrays
- Dim students(6)
- - Refer Example 3
9ASP Active Server Pages
Creating an ASP PAGE - 3
- Dynamic Content
- Create HTML dynamically
- Eg.Tables / Rows
- Refer Example 4 , 5
10ASP Active Server Pages
Creating an ASP PAGE - 4
- - Writing routines
- sub Add2Numbers(int1 , int2)
- response.write(int1 int2)
- end sub
11ASP Active Server Pages
Creating an ASP Form
ltform name Action METHODPOSTGETgt lt/formgt
Example 8 , 9
12ASP Active Server Pages
Handling cookies
- -Write to a cookie
- -Reading from a cookie
13ASP Active Server Pages
Response Object
- -Send output to the user from the server
14ASP Active Server Pages
Request Object
- -Get information from the user
15ASP 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(AccountNumber")ABCDE1234"
- Session(Location")Macomb
- Retrieving info from a Session
- Response.Write(Session(AccountNumber"))gt
16ASP Active Server Pages
Application Object
- To group the files in an application
17ASP Active Server Pages
Server Object
- -To access properties and methods on the server.
18ASP Active Server Pages
Error Object
- -Information of any error that
- occurs in scripts in an ASP page
19ASP Active Server Pages
Global.asa
ltscript language"vbscript" runat"server"gt sub
Application_OnStart 'some code end sub Sub
Application_OnEnd 'some code end Sub sub
Session_OnStart 'some code end sub sub
Session_OnEnd 'some code end sublt/scriptgt