Recommended: Asp reads data instance from cache Reading data from a file is faster than directly from the database. The test reads 6000 news. It took 23,579 milliseconds to read the database, and it took only 123 milliseconds to read the file. The following example is the method of using the code using file cache. Add the following code to the page that needs to use file cache. !--#includefile=FileCatch.asp-- % SetMyCatch=newCatchFile MyCatch.Overdue=10
ASP mainly has five built-in objects: Server, Request, Response, Application and Session. Now let’s explain them by giving examples. First is the most commonly used Response object.
Example 1 Use Response to output HTML documents in web pages
You can enter the above code in FrontPage Editor, or in a writer such as WordPad, Notepad, etc., and then save it as Example1.asp. The file name can be used with another, but the extension (or suffix) must be .asp. In the above example, the Write function of the Response object is used to transmit HTML code to the client's browser. The browser on the client will display the following list:
In fact, these HTML codes can be written directly in ASP files without using Response.Write to output. Generally, variables or some changed data can be output using Response.Write. In addition, we can also use <%=data or variable %> to output information, and its function is equivalent to Response.Write.
Example 2 Use Response and <%=data%> to output the calculation result added from 1 to 100 in the web page
The above examples do not indicate that the VB Script script language is used. At that time, because the default ASP is VB Script, if you want to use Java Script, you can use statements in the top line of ASP.
Indicate. Note that there must be a space between the symbol @ and LANGUAGE. Once specified, you can use JavaScript as you wish. For example 2, we can use JavaScript to complete it.
Example 3: Use JavaScript and <%=data%> to output the calculation result added from 1 to 100 in a web page
In this example, we used a flag pair and indicated that we used the JavaScript scripting language. Unlike HTML documents, the statement runat=server in this flag pair indicates that the script program is run on the server side, not transmitted to the client's browser and then explained and run. To prove this is simple, view the source file code in the browser and you won't see it
Share: Asp prevents web pages from refreshing code Reduce the server burden, asp prevents web page refresh code SubPreventRefresh() DimRefreshTime, isRefreshRefreshTime=10 prevents refresh time, unit (seconds) isRefresh=1 Whether to use anti-refresh function, 0=No, 1=YesIfisRefresh=1Then If(NotIsEmpty(Session(RefreshTime)))AndRefreshTime0Then IfDateDiff(s,Se