Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

ASP Tutorial
ASP Introduction
Run An ASP Web Page
ASP First Script
ASP Programming-VBScript
Variables in ASP
Array in ASP
Operators in ASP
ASP If Statements
ASP Select Statements
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
Application in ASP
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream
ASP Drive
ASP File
ASP Folder
ASP Dictionary
ASP ADO
ASP Ad Rotator
ASP Browser Cap
ASP Content Linking
ASP Content Rotator
ASP Quick Reference
ASP Summary

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


ASP Quick Reference

Previoushome Next



Basic Syntax

ASP scripts are enclosed by <% and %>.  To write some output to a browser:

<html>
<body>
<% response.write("I am Vyom!") %>
</body>
</html>

ASP uses VBScript as the default language. To use another scripting language, insert a language specification at the top of the ASP page:

<%@ language="javascript" %>
<html>
<body>

<%
....
%>


A D V E R T I S E M E N T



Forms and User Input

To collect values in a form with method="get",Request.QueryString is used. Information sent from a form with the GET method has limits on the amount of information to send and is visible to everyone (it will be displayed in the browser's address bar) and

To collect values in a form with method="post",Request.Form is used . Information sent from a form with the POST method has no limits on the amount of information to send and is invisible to others.

ASP Cookies

To identify a user,a cookie is often used. A cookie is a small t ext file that is stored on clientmachine that is embeded by the server . Each time the same computer requests a page with a browser, it will send the cookie too..

To create cookies,the Response.Cookies command is used :

<%
Response.Cookies("firstname")="Alex"
Response.Cookies("firstname").Expires="May 10,2002"
%>

Note: BEFORE the <html>,the Response.Cookies command must appear tag!

To retrieve a cookie value,the "Request.Cookies" command is used :

<%
fname=Request.Cookies("firstname")
response.write("Firstname=" & fname)
%>




Including Files

With the #include directive,you can insert the content of one ASP file into another ASP file before the server executes it. To create functions, headers, footers, or elements that will be reused on multiple pages,the #include directive is used

Syntax:

<!--#include virtual="somefile.inc"-->
or
<!--#include file ="somefile.inc"-->

To indicate a path beginning with a virtual directory,use the virtual keyword. The following line would insert the contents of "header.inc"if a file named "header.inc" resides in a virtual directory named /html:

<!-- #include virtual ="/html/header.inc" -->

To indicate a relative path,use the file keyword . A relative path begins with the directory that contains the including file. The following line would insert "header.inc" in your file if you have a file in the html directory, and the file "header.inc" resides in html\headers:

<!-- #include file ="headers\header.inc" -->

To include a file from a higher-level directory,use the file keyword with the syntax (..\) .




Global.asa

In an ASP application,the Global.asa file is an optional file that can contain declarations of objects, variables, and methods that can be accessed by every page.

Note:Each application can only have one Global.asa file and the Global.asa file must be stored in the root directory of the ASP application.

The Global.asa file can contain only the following:

  • Session events
  • Application events
  • <object> declarations 
  • TypeLibrary declarations
  • the #include directive

Application and Session Events

when the application/session starts or application/session ends ,it is necessary to tell the application and session objects in Glogal.asa about the work to be done. The code for this is placed in event handlers. Note: To insert scripts in the Global.asa file, we have to put the subroutines inside the HTML <script> tag,we do not use <% and %>:

<script language="vbscript" runat="server">
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 sub
</script>

<object> Declarations

By using the <object> tag,it is also possible to create objects with session or application scope in Global.asa. Note: The <object> tag should be outside the <script> tag!

Syntax:

<object runat="server" scope="scope" id="id"
{progid="progID"|classid="classID"}>
.......
</object>

TypeLibrary Declarations

The contents of a DLL file corresponding to a COM object is stored in a TypeLibrary. The constants of the COM object can be accessed by including a call to the TypeLibrary in the Global.asa file, and errors can be better reported by the ASP code. You can declare the type libraries in Global.asa if your Web application relies on COM objects that have declared data types in type libraries.

Syntax:

 <!--METADATA TYPE="TypeLib"
file="filename"
uuid="typelibraryuuid"
version="versionnumber"
lcid="localeid"
-->




The Session Object

To store information about, or change settings for a user session,the Session object is used. In a particular application,variables stored in the Session object hold information about one single user, and are available to all pages .

Collections

  • Contents - Holds every item added to the session with script commands

  • StaticObjects - Holds every object added to the session with the <object> tag, and a given session
  • Contents.Remove(item/index) - Deletes an item from the Contents collection

  • Contents.RemoveAll() - Deletes every item from the Contents collection

Properties

  • CodePage - Sets the code page that will be used to display dynamic content

  • LCID - Sets the locale identifier that will be used to display dynamic content

  • SessionID - Returns the session id

  • Timeout - Sets the timeout for the session

Method

  • Abandon - Kills every object in a session object



Application Object

An application may be a group of ASP files on the Web. To achieve some ourpose group of ASP file work together. In ASP ,The Application object is used to tie these files together.To store and access variables from any page, just like the Session object,the Application object is used. The difference is while with Sessions there is one Session object for EACH user but there is one Application object for ALL users that can be shared. In a particular application (like database connection information),the Application object should hold information that will be used by many pages .

Collections

  • Contents - Holds every item added to the application with script commands

  • StaticObjects - Holds every object added to the application with the <object> tag

  • Contents.Remove - Deletes an item from a collection

  • Contents.RemoveAll - Deletes every item from a collection

Methods

  • Lock - Prevents a user from changing the application object properties

  • Unlock - Allows a user to change the application object properties




The Response Object

The Response Object is used to send output to the user from the server.

Collection

  • Cookies(name) - Sets a cookie value. If the cookie does not exist, it will be created, and take the value that is specified

Properties

  • Buffer - Whether to buffer the output or not. When the output is buffered, the server will hold back the response until all of the server scripts have been processed, or until the script calls the Flush or End method. If this property is set, it should be before the <html> tag in the ASP file

  • CacheControl - Sets whether proxy servers can cache the output or not. When set to Public, the output can be cached by a proxy server

  • Charset(charset_name) - Sets the name of the character set (like "ISO8859-1") to the content type header

  • ContentType - Sets the HTTP content type (like "text/html", "image/gif", "image/jpeg", "text/plain"). Default is "text/html"

  • Expires - Sets how long a page will be cached on a browser before it expires

  • ExpiresAbsolute - Sets a date and time when a page cached on a browser will expire
  • IsClientConnected - Checks if the client is still connected to the server

  • Pics(pics_label) - Adds a value to the pics label response header

  • Status - Specifies the value of the status line

Methods

  • AddHeader(name, value) - Adds an HTML header with a specified value

  • AppendToLog string - Adds a string to the end of the server log entry

  • BinaryWrite(data_to_write) - Writes the given information without any character-set conversion

  • Clear - Clears the buffered output. Use this method to handle errors. If Response.Buffer is not set to true, this method will cause a run-time error

  • End - Stops processing the script, and return the current result

  • Flush - Sends buffered output immediately. If Response.Buffer is not set to true, this method will cause a run-time error

  • Redirect(url) - Redirects the user to another url
  • Write(data_to_write) - Writes a text to the user




Request Object

When a browser asks for a page from a server, it is called a request. The Request Object is used to get information from the user.

Collection

  • ClientCertificate - Holds field values stored in the client certificate

  • Cookies(name) - Holds cookie values

  • Form(element_name) - Holds form (input) values. The form must use the post method

  • QueryString(variable_name) - Holds variable values in the query string

  • ServerVariables(server_variable) - Holds server variable values

Property

  • TotalBytes - Holds the total number of bytes the client is sending in the body of the request

Method

  • BinaryRead - Fetches the data that is sent to the server from the client as part of a post request




Server Object

The Server Object is used to access properties and methods on the server.

Property

  • ScriptTimeout - Sets how long a script can run before it is terminated

Method

  • CreateObject(type_of_object) - Creates an instance of an object

  • Execute(path) - Executes an ASP file from inside another ASP file. After executing the called ASP file, the control is returned to the original ASP file

  • GetLastError() - Returns an ASPError object that will describe the error that occurred

  • HTMLEncode(string) - Applies HTML encoding to a string

  • MapPath(path) - Maps a relative or virtual path to a physical path

  • Transfer(path) - Sends all of the state information to another ASP file for processing. After the transfer, procedural control is not returned to the original ASP file

  • URLEncode(string) - Applies URL encoding rules to a string


Be the first one to comment on this page.




  ASP Tutorial eBooks
More Links » »
 
 ASP Tutorial FAQs
More Links » »
 
 ASP Tutorial Interview Questions
More Links » »
 
 ASP Tutorial Articles

No ASP Articles could be found as of now.

 
 ASP Tutorial News

No News on ASP could be found as of now.

 
 ASP Tutorial Jobs

No ASP Articles could be found as of now.


Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: asp world tour, asp tutorial, asp baton, asp surfing, asp hosting, free asp hosting, asp code, asp web hosting, asp scripts, asp pro surfing tour

HTML Quizzes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizzes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.