Tutorials to .com

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

ASP's Internet / Intranet Programming Frequently Asked Questions

Print View , by: iSee ,Total views: 13 ,Word Count: 1472 ,Date: Wed, 22 Apr 2009 Time: 12:18 PM

asp technology development based on Internet / Intranet on the MIS system is very convenient, first of all is that it borrows the concept of ADO technology and at the same time access the database through ODBC to the full flexibility and multi-platform, and another, due to the use of VBS and ASP JS scripting language, but also to 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, so pay attention to the development of some of the details. This article about a number of common problems and solutions are given.

Description of the problem

A. can not be correct to run ASP

When we set up a ASP file, and in line with the syntax, through the browser, enter the following address, or through the Explorer browser to open:
c: \ inetpub \ wwwroot \ a.asp
Can not run there will be mistakes, and do not prompt or file permissions can not access because, ASP document requires, first of all sites have the "execution (script)" attributes; and then enter the requested format in accordance with the URL address, rather than the DOS format, so Please correct these two errors.

B. mobile location procedure can not access the database

First of all, this error in the ODBC, if the ODBC data source settings are correct, then the need to pay attention to ASP in order to open the database: Conn.Open the parameters are correct. If correct, you need to pay attention to whether or not to use the global.asa file, which is the asp database connection 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
Attention should be paid to the DSN, which after SERVER is the name of the database server, if it is not correct, the need for correction. Another is the UID and PWD are correct; In addition, if the OPEN command using SESSION, that will require attention
Session ( "Customers_RuntimeUserName") = "sa"
Session ( "Customers_RuntimePassword") = ""
Is correct.

The use of C. RUNAT

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

D. not be able to insert a date field SQL SERVER

If you experience must be used to insert the date of the United States date format, then the need for the regional settings on the server set up China's long date format, please pay special attention to, ASP is running on the server to generate the results passed to the HTML browser, so All formatting must be on the server.

E. how to push the client message

If the server to determine the error, such as the registration of the failure of operational records, such as the right to prompt the user's information needs. Need to push this message to the client, and a prompt window, which is frequently encountered problems. This time, must be a way to use dynamic pages, because the error is judged on the server, and prompts in the browser appears. 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 number of the failure of the error is greater than 0
if conn.errors.count> 0 then
'The following code generation on the client scripting language, available to the browser
response.write "<script language=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. Client to make full use of fixed IP addresses

Because ASP is a regular connection database, the default is:
Session ( "Customers_ConnectionTimeout") = 15
Session ( "Customers_CommandTimeout") = 30
The two decided to set the time automatically disconnected after the timeout, so refresh the page when the re-implementation of ASP code, not enough time if the distribution of IP (dynamic IP allocation will take time, much longer than the static!), May not be able to connect, error message appears, so far as possible with a static IP address.


The use of ASP programming is very convenient. ADO and bounds as a result of the ODBC, the formation of a multi-threaded processing capabilities of the database operation and is running on the server, although the increase in the pressure of the server, the server is ready (even a PC server) processing capabilities are very strong, so Instead, the efficiency of the server to play. In addition, due to ASP and ActiveX controls can be a good interface, but also easy for developers to expand according to their own needs procedures and direct programming environment based on ASP, the only need to pay attention to is that we must to Internet / Intranet ideas design and programming, or they will not achieve much.

Asp and XML related Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.