|
1. 无奈正确运行ASP
当咱们树立了一个ASP文件,并且合乎语法时,通过阅读器输入以下地址,或通过(兄弟啊我们是同命相连啊,我去年一年的工资两万多全扔里面了,开个月薪不到三天就没了,你这回赢一百下回叫你输三百,老想往回赢点:信我的在别玩了:我现在都戒了:你想想你辛苦挣的还有你的父母钱就别玩了)
资源治理器翻开浏览:
c:\inetpub\
将出现无法运行的错误,并提示权限不对或文件无法访问,起因是,ASP文件首先
请求站点是具备“履行(脚本)”属性的;而后要求按照URL格局输入地址,而不
是Dos格式,所以,请纠正这两个错误。
2. 程序挪动地位后,无法访问数据库
这种错误首先在ODBC,如果ODBC数据源设置正确,那么需要注意ASP中打开数据库
的命令:Conn.Open 的参数是否正确。如果正确,则需要注意是否使用了global
.asa文件,该文件是ASP连接数据库的配置文件,该文件内容如下:
'You can add special event handlers in this file that will get run aut
omatically 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 appl
ication
'Session_OnEnd Runs when a user's session times out or quits your appl
ication
'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=(loc
al);UID=sa WD=;APP=Microsoft(R)Developer Studio;WSID=GREGLEAK;DATABAS
E=Customers"
Session("Customers_ConnectionTimeout") = 15
Session("Customers_CommandTimeout") = 30
Session("Customers_RuntimeUserName") = "sa"
Session("Customers_RuntimePassword") = ""
'==Visual InterDev Generated - DataConnection endspan==
End Sub
要留神其中的DSN,其中SERVER后必定是数据库服务器名称,如果该处不正确,需
要矫正。另外是UID和PWD是否正确;还有,如果OPEN命令使用了SESSION,则需要
注意
Session("Customers_RuntimeUserName") = "sa"
Session("Customers_RuntimePassword") = ""
是否准确。
3. RUNAT使用问题
在脚本语法中,有RUNAT参数,表示该脚本是运行在服务器上仍是客户机上。
如果有RUNAT=SERVER则脚本运行在服务器上,由ASP解释程序来解释执行,并将结
果传递给WWW服务器;否则就是运行在客户机上,由浏览器的脚本虚构机说明执行
,这时,和个别的脚本不区别。所以,一定要注意ASP语法中的命令,如:REQ
UEST,QUERYSTRING,WRITE等命令或对象必须在具备RUNAT参数的脚本运行;而访
问HTML的FORM对象的脚本一定没有RUNAT参数,因为HTML的FORM是客户机方面的对
象,服务器无法访问。
4. 无法向SQL SERVER插入日期字段
如果遇到必须使用美国日期格式插入日期的情况,则需要在服务器的区域设
置上设置中国长日期格式,请特殊注意,ASP是在服务器上运行的,天生的HTML结
果传递给浏览器,所以,所有格式设置必须在服务器上。
5. 如何向客户机推送提示信息
如果在服务器上断定访问错误,如注册失败、无权操作记载等需要提示用户
的信息。这个信息须要推送到客户机上,并呈现提醒窗口,这是常常碰到的问题
。这个时候,必须使用动态页面的方法,由于错误是在服务器上判定的,而提示
是在浏览器上出现的。我们 能够应用下面的ASP来推送错误:
on error resume next
conn=server.createobject("adodb.connection")
conn.open "pubs","wlf",""
'假如注册失败则过错数大于0
if conn.errors.count>0 then
‘以下代码生成客户机上的脚本语言,提供应浏览器执行
response.write "" & chr(13)
response.write {" & chr(13)
response.write window.alert("你无权拜访数据库!")" & chr(13)
response.write }" & chr(13)
response.write " & chr(13)
end if
6. 客户机尽量使用固定IP地址
因为ASP衔接数据库是定时的,默认是:
Session(Customers_ConnectionTimeout") = 15
Session("Customers_CommandTimeout") = 30
两个设置决议的时光,超时后主动断开连接,所以,当刷新页面从新执行ASP代码
时,如果IP分配时间不够(动态IP调配需要时间,比静态长良多!),可能无法
连接上,则涌现毛病信息,所以尽量用静态IP地址。??
跟请登录www.58jfw.com |
|