Recommended: Asp basic tutorial: summary of data transfer methods between web pages Introduction We always encounter this situation where we need to pass values from one web page to another. In this article, you are shown several ways to pass values from one page to another. In this example, the created web page consists of a text control and
1. Two solutions to ASP Chinese display
The first major problem that the author encountered when he first started writing ASP programs was the Chinese display problem. After running it, he found that all the Chinese read from the ASP from the database became ?????, which is a bit similar to the most frequent Chinese display problem in JSP. After checking the data, he found that there is a way to easily solve the Chinese problem.
Method 1:
After reading Microsoft NGWS documents, I found that in the FAQ section of the document, I mentioned that I wanted to add a config.web file to the web directory. I tried it and it was OK in Chinese.
The method is as follows:
Create a file config.web, with the content as follows, and placed in the WEB directory
| The following is the quoted content: <configuration> <globalization requestedcoding=utf-8 responseencoding=utf-8 /> </configuration> |
Later I saw someone posted a post in the forum online saying that it would be fine to replace utf-8 with gb2312. The author has not tried it, so you can give it a try.
Method 2:
Later, I subscribed to Microsoft's news group and found articles discussing this issue in Microsoft's news group dotnet.framework.aspplus.general. The method is to add <%@ CODEPAGE = 936 %> to the beginning of each page, which is a bit similar to <%@ page contentType=text/html;charset=gb2312%> in jsp and tested it quickly, and it was OK!!!
The examples are shown below:
| The following is the quoted content: <%@ CODEPAGE = 936 %> <%@ Import Namespace=System.Data %> <%@ Import Namespace=System.Data.ADO %> <%@ Import Namespace=System.Globalization %> <html> <head> <meta http-equiv=Content-Type content=text/html; charset=gb2312> </head> |
2. Tips for creating objects in ASP
When we use server components to create objects, there are generally two methods. The most commonly used method is to use the CreateObject() method of the SERVER object, like this:
SET NextLink = Server.CreateObject(MSWC.NextLink)
This method is very useful, but there is another way to save system resources more.
When you use the Server.CreateObject() method to create an object, the object is loaded immediately, and the system allocates memory and other resources to the object.
The second way to create an object is to use the <OBJECT> tag of HTML, and the syntax is as follows:
| The following is the quoted content: < OBJECT Runat=Sever ID=NextLink ProgID=MSWC.NextLink >< /OBJECT > |
When creating an object with the <OBJECT> tag, the object you want to create is not loaded immediately, but will not load until the method or attribute of the object is referenced for the first time. In this way, we will save some resources. Although not many, it is very helpful to save server resources when your system has to withstand nearly a million clicks a day.
Share: ASP instance hangs QQ's web source code ASP/PHP This code is suitable for you to use on the website, and ordinary friends can ignore this thing! ASP: CODE: [Copy to clipboard] <%dim objXMLHTTP, qq, pwd qq = 10000