请问下面这段ASP代码错在哪里应该怎样改正?

lanvnred 2011-09-03 09:04:51
主要是在登录管理员登录页面后,输入用户名和密码点提交时,在浏览器中不能显示页面


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include virtual="/Connections/conn.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("admin"))'更改--------------
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="admin.asp"
MM_redirectLoginFailed="msg.asp?info=对不起,登录失败"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_conn_STRING
MM_rsUser.Source = "SELECT id, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM admin WHERE id='" & Replace(MM_valUsername,"'","''") &"' AND password='" & Replace(Request.Form("password"),"'","''") & "'" '更改------------------
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理员登录</title>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>

<body>
<table style="display: inline-table;" border="0" cellpadding="0" cellspacing="0" width="601">
<!-- fwtable fwsrc="未命名" fwpage="页面 1" fwbase="web.gif" fwstyle="Dreamweaver" fwdocid = "2049282064" fwnested="0" -->
<tr>
<td width="33"><img src="images/spacer.gif" width="33" height="1" border="0" alt="" /></td>
<td width="539"><img src="images/spacer.gif" width="539" height="1" border="0" alt="" /></td>
<td width="28"><img src="images/spacer.gif" width="28" height="1" border="0" alt="" /></td>
<td width="10"><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="3"><img src="images/web_r1_c1.gif" width="600" height="72" border="0" id="web_r1_c1" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="72" border="0" alt="" /></td>
</tr>
<tr>
<td rowspan="2"><img src="images/web_r2_c1.gif" width="33" height="428" border="0" id="web_r2_c1" alt="" /></td>
<td bordercolor="#FF0000" background="images/web_r2_c2.jpg"><form id="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="400" border="1" align="center" cellpadding="2" cellspacing="3">
<tr>
<td colspan="2">           <strong>  <span class="STYLE1">    管  理  员  登  录</span></strong></td>
</tr>
<tr>
<td width="57">用户</td>
<td width="320"><label>
<input type="text" name="admin" />

</label></td>
</tr>
<tr>
<td>口令</td>
<td><label>
<input type="text" name="password" />
</label></td>
</tr>
<tr>
<td colspan="2">                        
<label>
<input type="submit" name="Submit" value="提交" />
</label>
      </td>
</tr>
</table>
</form> </td>
<td rowspan="2"><img src="images/web_r2_c3.gif" width="28" height="428" border="0" id="web_r2_c3" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="351" border="0" alt="" /></td>
</tr>
<tr>
<td><img src="images/web_r3_c2.gif" width="539" height="77" border="0" id="web_r3_c2" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="77" border="0" alt="" /></td>
</tr>
</table>
</body>
</html>
在浏览器中显示时的错误提示如下:无法显示网页
试图访问的网页出现问题,无法显示。

--------------------------------------------------------------------------------

请尝试执行下列操作:

单击刷新按钮,或稍后重试。

打开 localhost 主页,然后查找与所需信息相关的链接。
HTTP 错误 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------------------------------------------

技术信息(用于支持人员)

错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] 标准表达式中数据类型不匹配。
/login.asp, 第 22 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.3)

网页:
POST 40 ??? /login.asp

POST Data:
admin=sf&password=fs&Submit=%CC%E1%BD%BB

时间:
2011年9月3日, 下午 09:02:57


详细信息:
Microsoft 支持

...全文
61 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
mcyzz 2011-09-03
  • 打赏
  • 举报
回复
可能是你接的数据和数据库某个字段的类型不一样 比如文本接数字

28,391

社区成员

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

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