VB.NET制作的web登录页面如何使管理员和用户登录不同的页面
[size=14px]我是小白,,,,大致思路是这样的,网站有个管理网页,当管理员账号登录的时候直接进的是管理网页,而普通用户登录的就是普通界面。
与access表格连的 表格有USER Password Uid三个字段 Uid主要下面就是分为admin和user
下面是我一个小白的思路,但是不行 等进去的用户都直接进普通页面了,,,,求大神给思路或源码
Imports System.Data.OleDb
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Data
Imports System.Reflection
Imports Microsoft.Win32
Imports System.IO
Imports System.Web
Partial Class Denglu
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cnstr = "provider=microsoft.ace.oledb.12.0;data source=D:\网站学习\VQA CSS模板样式\Access\VQA.accdb"
'定义连接字符串
Dim cn As OleDbConnection
cn = New OleDbConnection(cnstr)
'定义连接
cn.Open()
Dim sql As String = "select * from VQA_Psw where UserID='" & TextBox1.Text.Trim() & "'and UserPassword='" & TextBox2.Text() & "' "
Dim sqlCmd As OleDbCommand = New OleDbCommand(sql, cn)
Dim admins As String = "select*from VQA_Psw where Uid='" + "admin" + "'"
Dim sqllCmd As OleDbCommand = New OleDbCommand(admins, cn)
Dim denglu2 As Integer = sqlCmd.ExecuteScalar
Dim denglu As String = sqllCmd.ExecuteScalar
If denglu = "admin" And denglu2 > 0 Then
Response.Redirect("Manage.aspx")
ElseIf denglu2 > 0 And denglu <> "admin" Then
Response.Redirect("Default.aspx")
Else
MsgBox("登录错")
End If
End Sub
End Class
[/size]