宾得好还是佳能好:ASP 网页程序代码问题,求教高人!! 急~~急

来源:百度文库 编辑:高考问答 时间:2024/05/03 03:42:14
求教高人,这段代码到底哪里错了? 运行就出现,内部服务器错误500

怎么回事,帮忙看下,谢谢了1!!!

<!-- #include file="conn.asp" --><!--#include file="inc/config.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim UserID,UserName,id,Content
UserID=session("UserID")
UserName=session("UserName")

set rs=server.createobject("adodb.recordset")
sql="select * from Comment"
rs.open sql,conn,1,3

If UserName="" or IsNull(WordID) Then
Response.Write ("<script>alert(' 操作错误! \n\n 可能您还没有登陆或者登陆超时! \n\n 如果您没有成为会员请先进行会员注册! \n\n 如果您已经是注册会员请重新登陆! ');history.back();</script>")
Response.End
End If
id=request("id")
Content=trim(Request.Form("Content"))
If Content="" Then
Response.Write ("<script>alert(' 操作错误! \n\n 请输入评论内容!~ ');history.back();</script>")
Response.end
elseIf strLength(Content)>100 then
Response.Write ("<script>alert(' 操作错误! \n\n 您输入的评论内容大于50字!~ ');history.back();</script>")
Response.end
End If

time_limit=30'设置限制时间秒
lastpost_time=request.cookies("lastpost_time")
if lastpost_time<>"" then'先判断是否有发言过,关了ie,时间没保存在cookies里.
lastpost=cdate(lastpost_time)'转换为日期类型
canbe_post=datediff("s",lastpost_time,now()) '这个是正值
else
canbe_post=time_limit+1
end if
if canbe_post <= time_limit then
response.write ("<script>alert(' 操作错误! \n\n 您还需休息:"&time_limit-canbe_post&"秒 ');history.back();</script>")
response.end
end if

Response.Cookies("lastpost_time")=now()

rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing

Stats=" 会 员 参 加 评 论 反 馈 信 息 "
%>
<script>
alert(' 操作成功! \n\n 感谢您参与书评^_^ ');history.back();

</script>
<p> </p>

帮你看了一下,你再调试看看,若还不行,你把500报错的文字帖出来看看,是哪行问题。
<!-- #include file="conn.asp" -->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim UserID,UserName,id,Content
UserID = session("UserID")
UserName = session("UserName")
Content = trim(Request.Form("Content"))
If UserName="" or IsNull(WordID) Then
Response.Write ("")
Response.End
End If
If Content="" Then
Response.Write ("")
Response.end
elseIf strLength(Content)>100 then
Response.Write ("")
Response.end
End If

set rs=server.createobject("adodb.recordset")
sql="select * from Comment"
rs.open sql,conn,1,3
rs.addnew
'写入数据库

rs("id") = request("id")
rs("Content") = Content

time_limit=30
lastpost_time=Request.Cookies("lastpost_time")
if lastpost_time<>"" then'先判断是否有发言过,关了ie,时间没保存在cookies里.
lastpost=cdate(lastpost_time)'转换为日期类型
canbe_post=datediff("s",lastpost_time,now()) '这个是正值
else
canbe_post=time_limit+1
end if
if canbe_post <= time_limit then
response.write ("")
response.end
end if

Response.Cookies("lastpost_time")=now()

rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing

%>
<script>
alert(' 操作成功! \n\n 感谢您参与书评^_^ ');history.back();

</script>
<p> </p>

这么看我是看不出来,再说也不知道数据库结构和include 的 asp代码。
出错了是要调试的,在服务器环境下一部分一部分的改代码,确定是哪一行出错,一般出错地方就在调用数据库操作的地方,或者是转换类型的地方,慢慢试吧。

你调试的时候最好用本地的服务器,不要用网上的服务器,因为自己服务器上调试的时候错误的信息很详细,再说你提问的时候要把相关的文件帖出来啊,不然大家就瞎猜了。

可以把报错页面打出来吗。
不过下面代码最好写清是javascript脚本。
("<script>alert(' 操作错误! \n\n 可能您还没有登陆或者登陆超时! \n\n 如果您没有成为会员请先进行会员注册! \n\n 如果您已经是注册会员请重新登陆! ');history.back();</script>")

去掉Internet选项里高级选项卡里的‘显示友好错误信息’前在贩勾,再看看具体报什么错,哪一行报错!