rimworld精心准备:请高手看看我这段ASP代码中response.redirect为什么不起作用?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/27 18:27:11
<% @ LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/md5.asp"-->
<%
dim struserid
dim struserpwd
dim stryanzhengma,stryzm
dim strSQL
struserid=trim(request.form("user"))
struserpwd=trim(request.form("pass"))
stryanzhengma=request.form("yanzhengma")
stryzm=Cstr(session("yanzhengma"))
if struserid="" or struserpwd=""then
FoundErr=true
ErrMsg=ErrMsg & "<br><li>用户名和密码不能为空!!!</li>"
end if
if stryanzhengma="" or stryanzhengma<>stryzm then
FoundErr=true
ErrMsg=ErrMsg & "<br><li>您输入的确认码和系统产生的不一致,请重新输入。</li>"
end if
if FoundErr=true then
call WriteErrMsg()
response.End()
end if
if stryanzhengma=stryzm then
'------ struserpwd=md5(struserpwd)
set rs=server.createobject("adodb.recordset")
strSQL="select * from admin where username='"&struserid&"' and password='"&struserpwd&"'"
' rs.cursortype=adopenkeyset
rs.open strSQL,conn'------,adOpenKeyset,adLockOptimistic,
if rs.BOF and rs.EOF then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>用户名或密码错误!!!</li>"
call WriteErrMsg()
rs.close
set rs=nothing
call Closeconn()
else
session.contents("userid")=struserid
session.contents("userpwd")=struserpwd
session.timeout=sessiontimeout
rs.close
set rs=nothing
call Closeconn()
response.Redirect( "news.asp" )
end if
end if
sub WriteErrMsg()
dim strErr
strErr=strErr & "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbcrlf
strErr=strErr & "</head><body>" & vbcrlf
strErr=strErr & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbcrlf
strErr=strErr & " <tr align='center'><td height='22' class='title'><strong>错误信息</strong></td></tr>" & vbcrlf
strErr=strErr & " <tr><td height='100' class='tdbg' valign='top'><b>产生错误的可能原因:</b><br>" & errmsg &"</td></tr>" & vbcrlf
strErr=strErr & " <tr align='center'><td class='tdbg'><a href='Admin_Login.asp'><< 返回登录页面</a></td></tr>" & vbcrlf
strErr=strErr & "</table>" & vbcrlf
strErr=strErr & "</body></html>" & vbcrlf
response.write strErr
end sub
%>

补充:1、在登陆页面输入错误密码,能够返回密码错误的提示。
2、在登陆页面输入正确密码,则不能显示"news.asp",而"news.asp"可以单独打开。
3、将response.redirect换成response.write "123456"则可以显示123456 。
请各位高手指教

Closeconn()
这个过程你没有写出
有可能照成错误
你将换成response.write "123456"则可以显示123456
说明你的程序可以运行到这里
那么我认为就是你的response.redirect 路径错误了
为了证实这两个观点哪个正确
你可以测试一下,一加上或删除掉这个过程
二,看正确登陆后是显示的原来的页面还是显示的找不到网页的页面,如果是后者就说明你的路径错误了呵呵,要注意跳转路径啊

关注一下