ASP object creation and Chinese display Solutions

Source: Internet
Author: User

I. ASP object creation skills
When we use server components to create objects, there are generally two methods. The common method is to use the Createobject () method of the server object, as shown in the following code:
Set nextlink = server. Createobject ("mswc. nextlink ")

This method is easy to use, but there is another way to save system resources.

When you create an object using the server. Createobject () method, the object is immediately loaded and the system allocates memory and other resources for the object.

The second method to create an object is to use the HTML <Object> tag. The syntax is as follows:
<Object runat = sever id = nextlink progid = "mswc. nextlink"> </Object>

When you use the <Object> tag to create an object, the object you want to create will not be loaded immediately, but will not be loaded until the method or attribute of this 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 receives nearly one million clicks every day.

2. asp Chinese display Solution
The author just started to write ASP +ProgramThe first big problem encountered was the problem of Chinese display. After running, it was found that all the Chinese characters read from the database by ASP + were changed ?????, Similar to JSP, the most frequently displayed problem occurs in Chinese. I checked the information and found that there is a way to easily solve the problem in Chinese.

Method 1:

After reading the Microsoft ngws document, I found that the FAQ section of the document mentioned that I want to add a config. Web file to the web directory. I tried it and the Chinese display was OK.

The method is as follows:
Create a config. Web file with the following content in the web directory:
Requestencoding = "UTF-8"
Responseencoding = "UTF-8"

Later, I saw a post in the Forum saying that it would be okay to change UTF-8 to gb2312. I have not tried it. You can try it.

Method 2:

Later, I subscribed to Microsoft's newsgroup. I found a topic discussed in Microsoft's newsgroup DOTNET. Framework. aspplus. General.ArticleThe method is to add <% @ codePage = "936" %> to the beginning of each page, which is somewhat similar to <% @ page contenttype = "text/html; charset = gb2312 "%> hurry up and test it. OK !!!

The example is shown below:
<% @ CodePage = "936" %>
<% @ Import namespace = "system. Data" %>
<% @ Import namespace = "system. Data. Ado" %>
<% @ Import namespace = "system. Globalization" %>

<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.