ASP登录后根据登录用户的不同跳转不同页面怎么实现

ASP登录后根据登录用户的不同跳转不同页面如何实现?
本帖最后由 winkeywei 于 2013-10-25 09:10:34 编辑

<!--#include file="Connections/connection.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("textfield"))
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 = "switch.asp"
  MM_redirectLoginFailed = "index.asp"

  MM_loginSQL = "SELECT [User], Pass"
  If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
  MM_loginSQL = MM_loginSQL & " FROM [admin] WHERE [User] = ? AND Pass = ?"
  Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
  MM_rsUser_cmd.ActiveConnection = MM_mynews_STRING
  MM_rsUser_cmd.CommandText = MM_loginSQL
  MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 50, MM_valUsername) ' adVarChar
  MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50, Request.Form("textfield2")) ' 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
%>


AC数据库用户表中用level字段区分不同用户,level的值是1,2,3三项,求教以上代码如何加上判断实现登录用户level值后跳转到相应页面1.asp,2.asp,3.asp
asp access 数据库

------解决方案--------------------
ASP登录后根据登录用户的不同跳转不同页面怎么实现
你用的DW自动生成的网站吧
用手写可以少好多代码
其实这个问题相对简单,你不要把想法弄的太复杂。
例子说明:
1、不从数据库读,就在做登陆的时候选权限,待验证用户名密码成功后,进入对应页面
<form id="form1" name="form1" method="post" action="check.asp">
  Userid
  <input type="text" name="Userid " id="Userid " />
  <br />
  Passwd
  <input type="text" name="Passwd" id="Passwd" />
  <br />
  <select name="page" id="page">
    <option value="admin.html">权限1</option>
    <option value="user.html">权限2</option>
  </select>
</form>

2、从数据读,就可以用数据库指定的字段值,选择进入相应的页面。

数据库 user.mdb
字段   userid(文本)   passwd(文本)   vip(数字)(根据你自己的需要设计)

'//前面的验证代在码就不写了,初学者就用if 语句就可以实现了:
if rs("vip")=1 then
response.redirect "vip1.asp"
else
response.redirect "user.asp"
end if
------解决方案--------------------
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("textfield"))
If MM_valUsername <> "" Then
  Dim MM_fldUserAuthorization
  Dim MM_redirectLoginSuccess