Advertisement

ASP examples

basis:

Write text with ASP
If you use ASP to generate text.
Adding HTML to text
If it generates HTML tags and plain text.

variable:

Declare variables
Variables for storing information. This example demonstrates how to declare variables, assign values ​​to variables and use the variables in the program
Declare an array
Array for storing a series of related data items. This example demonstrates how to declare an array to store the name.
Cycle generating HTML title
How to loop generates six different HTML headings.
Use Vbscript making greeting based on the time of
This example will display different messages to the user based on server time.
Make use of JavaScript greeting based on the time of
In this example above, but just different syntax.

program:

Subroutine call uses VBScript
How to call a subroutine written in VBScript from the ASP.
Subroutine calls using JavaScript
How to call routines written in JavaScript from ASP.
Call subroutines using VBScript and JavaScript
How to call a subroutine in VBScript and JavaScript in an ASP file.

Form:

Use method = "get" form
How to use the Request.QueryString command to interact with the user.
Use method = "post" form
How to use the Request.Form command to interact with the user.
Use the radio buttons Forms
How to use Request.Form to interact with the user via radio button.

Cookie:

Welcome cookie
How to create a Welcome cookie.

Response Object:

Write text using ASP
This example demonstrates how to use ASP to write text.
Use HTML tags to format text in ASP
This example demonstrates how to use ASP to text and HTML tags together.
Redirect users to a different URL
This example demonstrates how to redirect the user to another URL.
Shows random link
Demonstrates a hyperlink in this case, every time you load the page, it will display one of the two links.
Control buffer
This example demonstrates how to control caching.
Empty the cache
This example demonstrates how to empty the cache.
Terminate the script during processing and returns the result
This example demonstrates how to interrupt the operation of the script during processing.
Setting the page cache in the browser how many minutes before the page is invalid
This example demonstrates how the provisions before the expiry page in the browser cache time.
Settings page cache expiration date or time in a browser
This example demonstrates how to provide Page cache time date or time in a browser
Check whether the user is still connected to the server
This example demonstrates how to check whether the user has disconnected from the server.
Set the content type
This example demonstrates how to specify the type of content.
Character Set
This example demonstrates how to provide the name of the character set.

QueryString collection instance

When a user clicks on the link Contact information
This example demonstrates how to send some additional information to the query page in the link, and retrieve information on the target page (in this case, is the same page).
Simple application of the QueryString collection
This example demonstrates how to retrieve values ​​from the QueryString collection form. This form uses the GET method, the information that was accidentally sent to the user are visible (in the address). GET method also limits the amount of information transmitted.
How to use the information coming from a form
This example demonstrates how to use the values ​​retrieved from the form there. We will use the QueryString collection. This form uses the GET method.
More information from a form
This example demonstrates If the input field contains a number of the same name, then QueryString contains what. It will show how these same name separated. It also shows how to use keyword count to count the "name" attribute. This form uses the GET method.

Form collection instance

A set of simple application Form
This example demonstrates how to retrieve values ​​from the Form collection form. This form uses the POST method, which means that the information sent by the user is not visible, and on the amount of information transmitted is no limit (you can send a lot of information).
How to use information from a form
This example demonstrates how to use the information retrieved from the form. We use the Form collection. The form uses the POST method.
More information from a form
This example demonstrates the use of a number of input fields if the same name, Form collection contains what information. It will show how these same name separated. It also shows how to use keyword count to count the "name" attribute. This form uses the POST method.
Form with radio buttons
This example demonstrates how to use the Form collection to interact with the user via radio button. This form uses the POST method.
Form with a check button
This example demonstrates how to use the Form collection to interact with the user through the check button. This form uses the POST method.

Other examples

Get user information
How to identify the visitor's browser type, IP address and other information
Get server variables
This example demonstrates how to use the collection ServerVariables get the visitor's browser type, IP address and other information.
Create a welcome cookie
This example demonstrates how to use the Cookies collection to create a welcome cookie.
The total number of bytes sent by the user to detect
This example demonstrates how to use the TotalBytes property to get the total number of bytes sent by the user in the Request object.

Session Object

Settings and return LCID
This example demonstrates "LCID" property. This property sets and returns an integer indicating a location or region. Like date, time, and money, etc. should be displayed according to the location or region.
Back SessionID
This example demonstrates "SessionID" attribute. This property returns a unique id for each user. The id is generated by the server.
session timeout
This example demonstrates the "Timeout" property. This example sets and returns the session timeout (minutes).

Server Object

This file was last modified time?
Detection files were last updated.
Open and read a text file
The regular meeting open file "Textfile.txt" for reading.
Homemade hit counter
This example can be read from a file in a digital and accumulates in this number 1, then this number is written back to the document.

FileSystemObject Object

The specified file exist?
This example demonstrates how to first create a FileSystemObject object and then use the FileExists method to detect whether a file exists.
Specified folder exist?
This example demonstrates how to use the method to detect FolderExists a folder exists.
Specified drive exist?
This example demonstrates how to use the method to detect DriveExists a drive exists.
Get the name of a specified drive
This example demonstrates how to use GetDriveName method to get the name of a specified drive.
Name obtain a specified path to the parent folder
This example demonstrates how to use the method to get the name of the parent GetParentFolderName files in a specified folder path.
Get the folder name extension
This example demonstrates how to use the file GetExtensionName method to obtain the path specified in the last component extension.
Get filename
The last component of the filename This example demonstrates how to use the method to get GetFileName specified path.
Made base name of the file or folder
This example demonstrates how to use GetBaseName method to return the group name in the specified path or file folder.

TextStream object

Reading file
This example demonstrates how to use the FileSystemObject OpenTextFile method to create a TextStream object. ReadAll method TextStream object will get content from a text file that opens.
Read a text file a portion
This example demonstrates how to read only part of the contents of a text stream file.
Read a text file line
This example demonstrates how to read a line from a text stream file.
All the line that reads text files
This example demonstrates how to read all the lines from the text stream file.
Skip the text portion of the document
This example demonstrates how to skip a specified number of characters when reading a text stream file.
Skip text file line
This example demonstrates how to skip a line when reading the text stream file.
Returns the number of rows
This example demonstrates how to return the file in the text flow in the current line number.
Get the number of columns
This example demonstrates how to get the current character in the file column number.

Drive Object

Gets the specified number of drive space available
This example demonstrates how to first create a FileSystemObject object and then use AvailableSpace property to get the free space on a specified drive.
Obtain a specified drive space capacity
This example demonstrates how to use the space FreeSpace property to get the remaining space of a specified drive.
Obtain the total capacity of a specified drive
This example demonstrates how to use the TotalSize property to obtain the total capacity of the specified drive.
Obtain a specified drive drive letter
This example demonstrates how to use the DriveLetter property to obtain a specified drive drive letter.
Obtain a specified drive drive type
This example demonstrates how to use the property to get DriveType specified drive drive type.
Obtain a specified drive file system information
This example demonstrates how to use FileSystem drive to get the specified file system type.
Is the drive ready?
This example demonstrates how to use the IsReady property to check whether the specified drive is ready.
Obtain a specified drive path
This example demonstrates how to use the Path property to get the path of a specified drive.
Gets the specified drive's root folder
This example demonstrates how to use the RootFolder property to get the specified drive's root folder.
Gets the specified drive's serial number
This example demonstrates how to use the Serialnumber property to get the specified drive serial number.

File objects

When a file is created?
This example demonstrates how to first create a FileSystemObject object and then use the File object DateCreated property to get the date and time the specified file was created.
When this file is modified?
This example demonstrates how to use the DateLastModified property to get the date and time the specified file was modified.
When this file is accessed?
This example demonstrates how to use DateLastAccessed property to get the date and time the specified file was last accessed.
Returns properties of the specified file
This example demonstrates how to use the Attributes property to return the specified file.

Dictionary Objects

Specified key exist?
This example demonstrates how that first create a Dictionary object, and then use the Exists method to check whether the specified key exists.
It returns an array of all items
This example demonstrates how to use the Items method to return an array of all items.
It returns an array of all the keys
This example demonstrates how to use the Keys method to return an array of all the keys.
The return value of a project
This example demonstrates how to use the Item property to return the value of a project.
Set a key
This example demonstrates how to use the Key property to set a key in a Dictionary object.
Returns the number of key / item pairs
This example demonstrates how to use the Count property to return the number of key / item pairs.

AdRotator component

Simple examples AdRotator
This example shows: Every time a user visits or refreshes the page, how to use the AdRotator component to display a different advertisement image.
AdRotator - image link
This example shows: Every time a user visits or refreshes the page, how to use the AdRotator component to display a different advertisement image. In addition, the picture itself is a link.

Browser Capabilities Component

Browser Capabilities Component
This example demonstrates how to access a Web site measured every browser type, capabilities and version number.

Content Linking Component

Content Linking Component
The regular meeting to build a table of contents.
Content Linking Component 2
This example uses the Content Linking component between the pages in a text file to navigate.

Content Rotator (ASP 3.0)

Content Rotator Component
Whenever a user visits or refreshes the page, the component will display different HTML content string.