Dw服务器行为中:“用户登录”但是失败 100
问题是这样子的简单的页面但是dw做不出来,在很多网上找过,方法都是一样的asp+sql的环境IIS正常sql连接正常1.先在页面插入表单,然后差一个表格2.1行插入表单文...
问题是这样子的简单的页面但是dw做不出来,在很多网上找过 ,方法都是一样的
asp+sql的环境
IIS正常
sql连接正常
1.先在页面插入表单,然后差一个表格
2.1行插入表单文本域 user
3.2行插入表单文本域(password)然后是提交按钮
然后用服务器行为做用户登录
登录失败和成功的页面都是很简单的,几个字单独浏览没问题
设置好以后
按F12 浏览 输入用户名和密码 无论正确与否都是http500错误下面是代码
请不要和我说Http500错误的解决办法 我的iis其他asp网站是正常的
这个网站的基本设置没问题
<%@LANGUAGE="VBSCRIPT"%>
<!--#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("username"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "/main.asp"
MM_redirectLoginFailed = "/index.asp"
MM_loginSQL = "SELECT username, password"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.UserTable WHERE username = ? AND password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_conn_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 20, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 20, Request.Form("password")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
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
%><form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="100%" border="0">
<tr>
<td><input name="username" type="text" id="username" value="" size="45" /></td>
</tr>
<tr>
<td><input name="password" type="text" id="password" value="" size="45" />
<input type="submit" name="button" id="button" value="提交" /></td>
</tr>
</table>
</form>
这个代码我是直接复制dw的代码 ,我没有自己编写过 conn文件连接成功 展开
asp+sql的环境
IIS正常
sql连接正常
1.先在页面插入表单,然后差一个表格
2.1行插入表单文本域 user
3.2行插入表单文本域(password)然后是提交按钮
然后用服务器行为做用户登录
登录失败和成功的页面都是很简单的,几个字单独浏览没问题
设置好以后
按F12 浏览 输入用户名和密码 无论正确与否都是http500错误下面是代码
请不要和我说Http500错误的解决办法 我的iis其他asp网站是正常的
这个网站的基本设置没问题
<%@LANGUAGE="VBSCRIPT"%>
<!--#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("username"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "/main.asp"
MM_redirectLoginFailed = "/index.asp"
MM_loginSQL = "SELECT username, password"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.UserTable WHERE username = ? AND password = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_conn_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 20, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 20, Request.Form("password")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
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
%><form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="100%" border="0">
<tr>
<td><input name="username" type="text" id="username" value="" size="45" /></td>
</tr>
<tr>
<td><input name="password" type="text" id="password" value="" size="45" />
<input type="submit" name="button" id="button" value="提交" /></td>
</tr>
</table>
</form>
这个代码我是直接复制dw的代码 ,我没有自己编写过 conn文件连接成功 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询