“对象关闭时,不允许操作。”

iislove 2015-05-06 04:25:51
CkLogin.asp

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Config.asp" -->
<!--#include file="plus/Sub.asp" -->
<!--#include file="Plus/Function.asp" -->
<!--#include file="Plus/Md5.asp" -->
<%
if IsHostPost() then ToBack "对不起,提交的参数不正确,请使用IE浏览器登录!"
Dim UserName,UserPwd,ImagesCode
UserName=Request.Form("UserName")
UserPwd=Request.Form("UserPwd")
ImagesCode=Request.Form("ImagesCode")
if Trim(UserName)="" then ToBack "对不起,你输入的用户名为空!"
if Trim(UserPwd)="" then ToBack "对不起,你输入的密码为空,请确认!"
if NOT IsId(ImagesCode) then ToLink "对不起,请输入您的验证码!","login.asp"
if Cstr(ImagesCode)<>Cstr(session("checkCode")) then ToLink "对不起,您输入的验证码不正确,请确认!","login.asp"
if NOT IsComb(UserName) then ToBack "对不起,提交的用户名应该是数字或字母或组合,请确认!"'防止数据恶意注入
%>
<!--#include file="Inc/Conn.asp" -->
<%
OpenDataBase 1
sql="select top 1 * from SysAdmin where AdminName='"&UserName&"'"
rs.open sql,conn,1,3
if rs.EOF and rs.BOF then ToBack "对不起,没有找到该用户,请确认被高级管理员删除!"
if rs("AdminPwd")<>md5(UserPwd) then ToBack "对不起,你输入的密码不正确!"
if rs("flag")="超级管理员" then
'开始修正高级管理员的新闻权限
Dim SystemRole
SystemRole=""
sql="select * from bNewsClass"'获取新闻大类的权限
set rs1=conn.execute(sql)
do while NOT rs1.EOF
SystemRole=SystemRole+rs1("B_ClassId")+","
rs1.MoveNext
Loop
sql="select * from sNewsClass"'获取新闻小类的权限
set rs1=conn.execute(sql)
do while NOT rs1.EOF
SystemRole=SystemRole+rs1("S_ClassId")+","
rs1.MoveNext
Loop
rs1.close
set rs1=nothing
SystemRole=","+SystemRole+","
SystemRole=Replace(SystemRole,",,",",")
rs("root")=SystemRole
rs.update
end if
'检查登陆成功
Dim IMS_SysUserName,IMS_SmallClassValue,IMS_RoleName,IMS_UserId,IMS_RealName,IMS_BigClassValue,Md5Key
IMS_SysUserName=Cstr(UserName)
IMS_SmallClassValue=Cstr(rs("root"))
IMS_RoleName=Cstr(rs("flag"))
IMS_UserId=Cstr(rs("aID"))
IMS_RealName=Cstr(rs("AdminRealName"))
'结束
sql="select top 1 * from SysAdminRole where flag='"&rs("flag")&"'"
rs.close
rs.open sql,conn,1,1
if rs.EOF or rs.BOF then ToBack "发生意外,无法找到你的操作权限,请联系设计人员!"
'找到管理员的目录权限
IMS_BigClassValue=Cstr(rs("Role"))'当前管理员的目录权限
'结束
IoClose

Md5Key=IMS_CookieRndString+IMS_SysUserName+IMS_SmallClassValue+IMS_RoleName+IMS_UserId+IMS_RealName+IMS_BigClassValue
Response.Cookies(IMS_ParentCookieName)("SysUserName")=IMS_SysUserName'当前管理员的名字
Response.Cookies(IMS_ParentCookieName)("SmallClassValue")=IMS_SmallClassValue'当前管理员的新闻发布的权限
Response.Cookies(IMS_ParentCookieName)("RoleName")=IMS_RoleName
Response.Cookies(IMS_ParentCookieName)("UserId")=IMS_UserId
Response.Cookies(IMS_ParentCookieName)("RealName")=IMS_RealName
Response.Cookies(IMS_ParentCookieName)("BigClassValue")=IMS_BigClassValue'当前管理员的目录权限
Response.Cookies(IMS_ParentCookieName)("GuestMd5Key")=md5(Md5Key)
Session.Abandon()'清除服务器的Session会话
%>
<script language="javascript">location.href="Manager.html";</script>


conn.asp

<!--#include file="DataName.asp" -->
<!--#include file="RootPath.asp" -->
<%
if NOT Response.IsClientConnected then Response.End()
Dim IMS_DbPath

IMS_DbPath="Data/IncData/"+MyDataName

Dim conn,ConnStr,rs,sql
Sub OpenDataBase(Flag)
Dim IMS_DbPath_Sub,i,DbPathDivCount
On Error Resume Next
if Not Isnumeric(Flag) then
Response.Write "你好,连接配置参数#"+Cstr(Flag)+"有问题,请检查!"
Response.End
end if

DbPathDivCount=Flag'获取数据库所在目录层数

IMS_DbPath_Sub=IMS_DbPath'获取数据库基本层位置

for i=2 to DbPathDivCount'开始进行数据库层计算
IMS_DbPath_Sub="../"+IMS_DbPath_Sub
next
connstr = "driver={SQL Server};server=localhost;uid=tzfm;pwd=zwz;database=tzfm"
'ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(IMS_DbPath_Sub)'使用了Jet为数据驱动程序
'ConnStr="DBQ="+Server.MapPath(""&IMS_DbPath_Sub&"")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"'使用Access自带的驱动程序
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")
conn.open ConnStr

IMS_DbConnOpenInit=True'告诉系统已经打开了数据库

If Err Then
rs.close
conn.close
Set rs=nothing
Set conn = Nothing
Response.Write "<div align=""center"" style=""padding-top:50px;""><strong style=""color:red; font-weight:bold; font-size:20px; font-family:黑体;"">网站错误提示:</strong><hr/><div style=""text-align:left; line-height:180%; padding-left:260px;""><strong>数据库连接错误和相关描述:<div style=""padding:8px; border:1p #999999 solid; background:#FFFFCC; color:#0000FF;"">“" & Err.Description & "”</div></strong><br/><strong><font color='FF0000'>网聚网络</font>客户服务:</strong><br/>  服务热线:0595-22255800 <br>  项目组热线:0595-22189800 22519800 22539800 或直接致电:13774851106(沈小姐)</a>!<br>  传真:0595-22255800/0595-22515657<br>  网址:<a href='http://www.woooo.net.cn' target='_blank'>www.woooo.net.cn</a><br>  E-mail:sokia@woooo.net.cn<br></div></div>"
Response.End
Exit Sub
End If
End Sub

Sub IoClose()
if Cbool(IMS_DbConnOpenInit) then
Set rs=nothing
Set conn = Nothing
end if
End Sub
%>


“对象关闭时,不允许操作。”,代码是否有问题啊?为什么会这样?
...全文
362 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Dogfish 2015-05-08
  • 打赏
  • 举报
回复
楼主有加on error吗?有可能中间就错了,到最后显示的是第二个地方出错。
Dogfish 2015-05-07
  • 打赏
  • 举报
回复
上面的回复看错了。我自己删除不了。
Dogfish 2015-05-07
  • 打赏
  • 举报
回复
rs1.close 这里已经关闭了。后面当然出错。 set rs1=nothing SystemRole=","+SystemRole+"," SystemRole=Replace(SystemRole,",,",",") rs("root")=SystemRole rs.update
iislove 2015-05-07
  • 打赏
  • 举报
回复
引用 3 楼 centurybobo 的回复:
set rs1=nothing 要放在页面的最后,否则每执行一次查询,需重新定义一下rs
不是这个问题吧?我现在就想知道怎么连上去~
iislove 2015-05-07
  • 打赏
  • 举报
回复
引用 4 楼 snfqbujj1 的回复:
sql="select top 1 * from SysAdminRole where flag='"&rs("flag")&"'" rs.close rs.open sql,conn,1,1你这先关了,再去打开数据库呀, if rs.EOF or rs.BOF then ToBack "发生意外,无法找到你的操作权限,请联系设计人员!" If Err Then rs.close conn.close Set rs=nothing Set conn = Nothing 顺序也改改吧 rs.close Set rs=nothing conn.close Set conn = Nothing Response.Write "<div align=""center"" style=""padding-top:50px;""><strong style=""color:red; font-weight:bold; font-size:20px; font-family:黑体;"">网站错误提示:</strong><hr/><div style=""text-align:left; line-height:180%; padding-left:260px;""><strong>数据库连接错误和相关描述:<div style=""padding:8px; border:1p #999999 solid; background:#FFFFCC; color:#0000FF;"">“" & Err.Description & "”</div></strong><br/><strong><font color='FF0000'>网聚网络</font>客户服务:</strong><br/>  服务热线:0595-22255800 <br>  项目组热线:0595-22189800 22519800 22539800 或直接致电:13774851106(沈小姐)</a>!<br>  传真:0595-22255800/0595-22515657<br>  网址:<a href='http://www.woooo.net.cn' target='_blank'>www.woooo.net.cn</a><br>  E-mail:sokia@woooo.net.cn<br></div></div>" Response.End Exit Sub End If End Sub 还有看到你里面搞了好几个Set conn = Nothing你只需要放一个到最后面就行了
我压根不会ASP,外包程序 现在想加功能,我只会ASP.NET 至少要将这个asp网站搭建在本地测试才行吧 ASP的页面代码和程序代码混合在一起看的蛋都碎了
snfqbujj1 2015-05-07
  • 打赏
  • 举报
回复
sql="select top 1 * from SysAdminRole where flag='"&rs("flag")&"'" rs.close rs.open sql,conn,1,1你这先关了,再去打开数据库呀, if rs.EOF or rs.BOF then ToBack "发生意外,无法找到你的操作权限,请联系设计人员!" If Err Then rs.close conn.close Set rs=nothing Set conn = Nothing 顺序也改改吧 rs.close Set rs=nothing conn.close Set conn = Nothing Response.Write "<div align=""center"" style=""padding-top:50px;""><strong style=""color:red; font-weight:bold; font-size:20px; font-family:黑体;"">网站错误提示:</strong><hr/><div style=""text-align:left; line-height:180%; padding-left:260px;""><strong>数据库连接错误和相关描述:<div style=""padding:8px; border:1p #999999 solid; background:#FFFFCC; color:#0000FF;"">“" & Err.Description & "”</div></strong><br/><strong><font color='FF0000'>网聚网络</font>客户服务:</strong><br/>  服务热线:0595-22255800 <br>  项目组热线:0595-22189800 22519800 22539800 或直接致电:13774851106(沈小姐)</a>!<br>  传真:0595-22255800/0595-22515657<br>  网址:<a href='http://www.woooo.net.cn' target='_blank'>www.woooo.net.cn</a><br>  E-mail:sokia@woooo.net.cn<br></div></div>" Response.End Exit Sub End If End Sub 还有看到你里面搞了好几个Set conn = Nothing你只需要放一个到最后面就行了
会织网的蚂蚁 2015-05-07
  • 打赏
  • 举报
回复
set rs1=nothing 要放在页面的最后,否则每执行一次查询,需重新定义一下rs

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧