Tutorials to .com

Tutorials to .com » Asp » Skills » ASP's Internet / Intranet Programming Frequently Asked Questions

ASP's Internet / Intranet Programming Frequently Asked Questions

Print View , by: iSee ,Total views: 14 ,Word Count: 1434 ,Date: Wed, 26 Aug 2009 Time: 10:02 AM

ASP-based technology development Internet / Intranet on the MIS system is very convenient, first of all is that it borrowed the concept of ADO technology and at the same time through the ODBC access to databases, to achieve sufficient flexibility and multi-platform nature, In addition, because the use of VBS and asp JS scripting language, but also ensure that the majority of developers will soon enter the development process, reducing the learning process.
However, because ASP is based on Internet / Intranet mode, and it and the traditional c / S structure is different, after all, so that development should pay attention to some of the details. This article describes some of the common problems and gives solutions.

Description of the problem

A. can not be correctly ASP

When we set up an ASP file, and consistent syntax, through the browser, enter the following address, or through Explorer to open the browser:
c: \ inetpub \ wwwroot \ a.asp
Can not run the error will appear and prompt the file permissions are incorrect or can not access because, ASP file requires first and foremost the site is to have "the implementation of (script)" attributes; and then ask the URL format, enter an address in accordance with, rather than the DOS format, therefore, Please correct these two errors.

B. move the program location, can not access the database

This error first in ODBC, if the ODBC data source settings are correct, then the need to pay attention to open the database ASP commands: Conn.Open parameters are correct. If correct, you need to pay attention whether to use the global.asa file, which is the ASP connect to the database configuration file, which reads as follows:
'You can add special event handlers in this file that will get run automatically when special Active Server Pages events
'occur. To create these handlers, just create a subroutine with a name from the list below that corresponds to the event
'you want to use. For example, to create an event handler for Session_OnStart, you would put the following code into this
'file (without the comments):
'EventName Description
'Session_OnStart Runs the first time a user runs any page in your application
'Session_OnEnd Runs when a user's session times out or quits your application
'Application_OnStart Runs once when the first page of your application is run for the first time by any user
'Application_OnEnd Runs once when the web server shuts down

Sub Session_OnStart
'== Visual InterDev Generated - DataConnection startspan ==
'- project Data Connection
Session ( "Customers_ConnectionString") = "DRIVER = (SQL Server); SERVER = (local); UID = sa; PWD =; APP = Microsoft (R) Developer Studio; WSID = GREGLEAK; database = Customers"
Session ( "Customers_ConnectionTimeout") = 15
Session ( "Customers_CommandTimeout") = 30
Session ( "Customers_RuntimeUserName") = "sa"
Session ( "Customers_RuntimePassword") = ""
'== Visual InterDev Generated - DataConnection endspan ==
End Sub
Should pay attention to one of the DSN, which must be post-SERVER database server name, and if there is not correct, need to be corrected. Another is the UID and PWD are correct; Also, if the OPEN command using the SESSION, you need to pay attention
Session ( "Customers_RuntimeUserName") = "sa"
Session ( "Customers_RuntimePassword") = ""
Is correct.

C. RUNAT use

Syntax in the script, there are RUNAT parameters, indicates that the script is running on the server or the client machine. If there is RUNAT = SERVER the script running on the server from the ASP interpreter to explain the implementation and the results passed to the WWW server; otherwise, it is running on the client machine, by the browser script to explain the virtual machine implementation, this time, and general The script is no different. Therefore, we must pay attention ASP syntax commands, such as: REQUEST, QUERYSTRING, WRITE or object such as a command parameter must have been RUNAT script; and access to HTML, the script FORM object must not RUNAT parameters, because of HTML's FORM a client machines in the object, the server is inaccessible.

D. was unable to insert a date field in SQL SERVER

If you are experiencing must use the U.S. date format the date into the case, you need to set the server's regional settings of China's long date format, please pay special attention to, ASP is running on the server, the generated HTML results passed to the browser, therefore, All formatting must be on the server.

E. How do I push to the client tips

If the server to determine the error, such as registration fails, no right operating records needed to prompt the user information. This information needs to push on to the client, and prompt window, which is frequently encountered problems. This time, you must use dynamic pages, as this error is judged on the server, while the tips are appearing in the browser. We can use ASP to push the following error:
on error resume next
conn = server.createobject ( "adodb.connection")
conn.open "pubs", "wlf", ""
'If the registration fails then the number of errors is greater than 0
if conn.errors.count> 0 then
'The following code is generated on the client scripting language, made available to the browser implementation of the
Response.Write "<script language="JavaScript" JavaScript" "& chr (13)
response.write "(" & chr (13)
response.write "window.alert (" You do not have access to the database! ")" & chr (13)
response.write ")" & chr (13)
response.write "</ script>" & chr (13)
end if

F. The client to make use of a fixed IP address

As the ASP to connect database is timing, the default is:
Session ( "Customers_ConnectionTimeout") = 15
Session ( "Customers_CommandTimeout") = 30
2 setting determines the time, automatically disconnected after the timeout, so when you refresh the page to re-implementation of the ASP code, the allocation of time is not enough if the IP (dynamic IP allocation will take time, much longer than the static!), May not be able to connect on then the error message, so try to use a static IP address.


The use of ASP programming is very convenient. Because ADO crossed the ODBC, the formation of multi-threaded processing capabilities with the database mode of operation, and is run on the server, although the increase in pressure on the server, Fortunately, the current server (even a PC server) capabilities are very strong, so that Instead, the efficiency of the server to play. In addition, since ASP and ActiveX controls can be a good interface, but also allows developers to easily according to their need to expand the program, and directly based on ASP programming environment, the only caveat is that we must in order to Internet / Intranet ideas design and write programs, or will be limited.

ASP skills Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.