Object 1, Buffer property
This property is used to specify whether the buffer is used when the page is exported, and the default value is False. When it is true, the results are not exported to the browser until the entire active Server page execution ends. Such as:
<%Response.Buffer=True%>
<Head>
<title>buffer Example </title>
<body>
<%
For I=1 to 500
Response.Write (I & "<br>")
Next
%>
</body>
When this page executes, all of the contents of the entire home page are displayed in the browser at the same time, and the home page will be in the cache until the script finishes executing.
2, Expires property
This property is used to set the length of time (in minutes) that the browser caches pages and must be refreshed on the server side. Use the following settings:
<%Response.Expires=0%>
By adding this line of code to the ASP file, you require that each request be refreshed because response will expire as soon as it receives the page.
3. Write method
This method sends the data to the client browser, such as:
<%response.write "hello,world!" %>
4, redirect method
This method allows the browser to relocate to another URL so that when a client issues a Web request, the client's browser type is determined and the customer is relocated to the appropriate page. Such as:
<title>redirect Example </title>
<body>
<form aciton= "formjump.asp" method= "POST" >
<select name= "Wheretogo" >
<option selected value= "Fun" >Fun</option>
<option value= "News" >News</option>
<option value= "Sample" >Sample</option>
</select>
<input type=submit name= "Jump" value= "Jump" >
</form>
</body>
The above is the submitted form, and the following is the file that processes the form formjump.asp:
<%response.buff=true%>
<title>redirect Example </title>
<body>
<%
Thisurl= "http://www.tinyu.com/";
Where=request.form ("Wheretogo")
Select case where
Case "Fun"
Response.Redirect Thisurl & "/fun/default.asp"
Case "News"
Response.Redirect Thisurl & "/news/default.asp"
Case "Sample"
Response.Redirect Thisurl & "/sample/default.asp"
End Select
%>
</body>
This example when the user selected, press the "Jump" button to submit the form, the server received the request after the call formjump.asp to locate the corresponding URL. But here's one thing to note that HTTP headers are already written to the client browser, and any changes to the HTTP headers must be made before the page content is written, as follows:
<@ language= at the beginning of the file. > Write After:
Response.buffer=true
At the end of the set:
Response.Flush
Here flush is a method of response, it must be the buffer property set to true to use, or it will produce a run mode error. The other clear method is also used to purge cached pages, and to use the Buffer property when set to True.
5. End method
This method is used to tell Active server to stop processing an ASP file when it encounters this method. If the response object's Buffer property is set to True, the end method sends the contents of the cache to the customer and clears the flushing area. So to cancel all the output to the customer, you can clear the buffer first and then use the End method. Such as:
<%
Response.buffer=true
On Error Resume Next
Err.Clear
If Err.number<>0 Then
Response.Clear
Response.End
End If
%>
Server object:
The server object provides access to methods and properties on the server. Most of these methods and properties are serviced as functionality of the utility.
Grammar
Server.property|method
Property
ScriptTimeout:
The ScriptTimeout property specifies how long the script can run maximum before it ends. When the server component is processed, the time-out limit is no longer in effect.
Syntax server.scripttimeout = numseconds
Parameter numseconds
Specifies the maximum number of seconds a script can run before being terminated by the server. The default value is 90 seconds.
Comments
You can set the default ScriptTimeout value for a Web service or Web server by using the AspScriptTimeout attribute in the metabase. The ScriptTimeout property cannot be set to less than the value specified in the metabase. For example, if Numseconds is set to 10, and the metabase setting contains a default value of 90 seconds, the script times out after 90 seconds. However, if the numseconds is set to 100, the script times out after 100 seconds.
For more information about using the metabase, see About metabase.
Example in the following example, if the server processing script exceeds 100 seconds, it will timeout.
<% server.scripttimeout =%>
The following example gets the current value of the ScriptTimeout property and stores it in the variable TimeOut.
<% TimeOut = Server.ScriptTimeout%>
Method
CreateObject
The CreateObject method creates an instance of the server component. If the component executes the OnStartPage and ONENDPA
[1] [2] [3] Next page