SSI directives provide a way for users to insert the contents of one file into another file before the WEB server is processed. The ASP uses only #include directives for this mechanism. To insert a file in an. asp file, use the following syntax:
<!--#include Virtual | FILE = "FileName"-->
The virtual and file keywords indicate the type of path that is used to contain the file, and filename is the path and name of the file that you want to include.
The included file does not require a special file name extension, but it is a good programming practice to assign the. inc extension to the included file to differentiate it from other types of files.
Use the Virtual keyword
Use the virtual keyword to indicate that the path starts with the virtual directory. For example, if a file named Footer.inc belongs to a virtual directory named/myapp, the following row inserts the contents of Footer.inc into the file containing the row:
<!--#include virtual = "/myapp/footer.inc"-->
Use the File keyword
Use the file keyword to indicate that a relative path is used. The relative path begins with the directory containing the containing file. For example, if your file is in the directory Myapp and the file Header1.inc is in Myapp\headers, the following line inserts Header1.inc into your file:
<!--#include file = "Headers/header1.inc"-->
Note that the path to the contained file headers/header1.inc is relative to the containing file, and if the script containing the #include statement is not in the/myapp directory, then the statement will not work.
If the Enable upper-layer Directory option is selected in Internet Services Manager, you can also use the file keyword and the. /syntax contains the parent directory, which is the file in the previous level directory. For commands, see Configuring ASP applications.
The location of the included file
The included files can be in a directory within your Web site, or outside your Web site. Typically, you should make the included files in the directory of your Web site. If a included file is located within your Web site, the next time the browser requests the include file, the changes to the included file are displayed. However, if the included file is outside your Web site, this change will not be reflected until the ASP application restarts or the Web server restarts. The ASP detects changes to any include files in the application's namespace (in the application's starting directory).
Include files: Hints and warnings
A included file can also contain other files. If the #include instruction does not cause a loop, an. asp file can include the same file multiple times. For example, if the file first.asp contains a file second.inc, then second.inc must no longer contain first.asp. A file cannot contain itself. The ASP detects such loops or nesting errors, generates an error message when detected, and stops processing the requested. asp file.
ASP contains files before executing script commands. Therefore, you cannot use script commands to create the name of the included file. For example, the following script will not open Header1.inc because the ASP executes #include instructions before it assigns a filename to the variable name.
<!--This script would fail-->
<% name= (Header1 & ". Inc")%>
<!--#include file= "<%= name%>"-->
Script commands and procedures must be fully contained in script delimiters <% and%>, HTML tags <SCRIPT> and </SCRIPT> or HTML tags <OBJECT> and </OBJECT>. In other words, you cannot open a script delimiter in an. asp include file, and then close the delimiter in a contained file; the script or script command must be a complete unit. For example, the following script will not run:
<!--This script would fail-->
<%
For i = 1 to n
Statements in main file
<!--#include file= "Header1.inc"-->
Next
%>
The following script will work correctly:
<%
For i = 1 to n
Statements in main file
%>
<!--#include file= "Header1.inc"-->
<% Next%>
-------------------
North Star Stacks | | Http://www.ebook007.com
Using HTML Tables
Use ASP Request table data. In this topic, you will not only learn how to create basic table-processing scripts, but you will also get some useful techniques for validating tabular information on WEB servers and user browsers.
About HTML Tables
The most common method of information is to provide an arrangement of special HTML tags for user interface controls on a Web page. text boxes, buttons, and check boxes are typical controls that enable users to interact with a Web page and submit information to a Web server.
The following HTML Web Server's button. The table also contains an implied control (which is not displayed by the Web browser) that you can use to pass additional information to your Web browser.
<form method= "POST" action= "myfile.asp" >
<input type= "text" name= "FirstName" >
<input type= "text" name= "LastName" >
<input type= "text" name= "age" >
<input type= "hidden" name= "UserStatus" value= "new" >
<input type= "Submit" value= "Enter" >
</FORM>
When a table submits information to a Web server, the user's Web browser requests the. asp file specified in the HTML <form > tag's ACTION attribute (in the previous example, the file is called myfile.asp). The. asp file contains processing table values, such as A script that displays a result table or queries information from a database.
The value of the table
A static. htm file can contain a table that sends its numeric value to an. asp file.
An. asp file can create a table that sends its information to another. asp file.
An. asp file can create a table that contains its information to itself, that is, the file containing the table.
The first two methods work the same way, and when the table interacts with the gateway program, it can include reading and responding to user-selected commands in addition to ASP.
Creating an. asp file that contains a table definition and transmits information to itself is more complex, but it is a powerful way to process tables. This process in
The ASP Request object provides two sets of collections that greatly simplify the task of retrieving tabular information attached to a URL request.
QueryString Collection
The QueryString collection gets the value that is passed to the WEB server as text following the question mark at the requested URL. By using the HTTP get method or by manually adding a table's value to the URL, the table's value can be appended to the requested URL.
For example, if the previous table example uses the Get method (ACTION = "get") and the user types Jeff, Smith, and 30, the following URL request is sent to the server:
Myfile.asp contains the following table processing scripts:
Hello, <%= request.querystring ("FirstName")%> <%= request.querystring ("LastName")%>.
You are <%= request.querystring (' age ')%> years old.
<%
If request.querystring ("userstatus") = "New User" then
Response.Write "This is your" the "This is" a visit to the Web site! "
End If
%>
In this case, the Web server will return the following text to the user's Web browser:
Hello, Jeff Smith. You are are years old. This is your the visit to this Web site!
The QueryString collection has an optional parameter that you can use to access one of the multiple values displayed in the request body. You can also use the Coun