如何在asp.net中创建具有用户角色的登录

如何在asp.net中创建具有用户角色的登录,asp.net,Asp.net,有两个表,一个是使用电子邮件id、用户名、密码、名称进行登录,其中电子邮件id是主键;第二个表是使用id作为主键的Employee_角色、emp_角色和作为登录电子邮件id外键的emailid 这里的条件是在emprole中有admin,当任何用户首先登录时 检查该电子邮件id是否处于employee_角色中,如果是,它将指向“admin page”,否则它找不到任何电子邮件id,它将指向“guest page” 请让我更新鲜,帮我 Please i am fresher do help me.

有两个表,一个是使用电子邮件id、用户名、密码、名称进行登录,其中电子邮件id是主键;第二个表是使用id作为主键的Employee_角色、emp_角色和作为登录电子邮件id外键的emailid

这里的条件是在emprole中有admin,当任何用户首先登录时 检查该电子邮件id是否处于employee_角色中,如果是,它将指向“admin page”,否则它找不到任何电子邮件id,它将指向“guest page”

请让我更新鲜,帮我

Please i am fresher do help me...
我们都是从某个地方开始的,所以没有他们的问题。我知道我看到你投了很多反对票。那是因为你自己没有真正尝试过,或者没有分享你尝试过的东西。以下是一些关于你的问题的一般性建议。你需要再仔细研究一下,然后回答问题。我必须做一些假设才能让你从这里开始

There are two tables one is Login with Email id, username, password, name and where email id is primary key and the second table is Employee_role with id as primary key, emp_role, and emailid as foreign key of login email id.
我假设创建这些表不需要特定的帮助。您显然知道外键和主键约束

here the condition is in emprole there is admin and whenver any user log in it first check if that emaild id is in employee_role if yes it would direct to "admin page" if otherwise it didnot find any emailid it will direct to "guest page"
以下是在SQL中实现这一点的一种方法:

SELECT l.email, l.userid, l.password, 
Case when r.emp_role is not null then 'admin.aspx' else 'guest.aspx' END as 
'TransferPage'
from dbo.Login l
LEFT OUTER JOIN dbo.employee_role r on l.emailid = r.emailid
WHERE email = @email  --Assumes you pass in parameter @email
获取此查询的结果,并将返回查询的密码与输入文本的密码进行比较,如果密码有效,则执行以下操作:

response.redirect
到查询返回的页面


希望这对您有所帮助……

您的问题很难回答,因为您没有指出您的代码现在能做什么。您需要控制结构方面的帮助吗?您需要从数据库中获取信息的帮助吗?请查看,因为他们有大量的示例和教程帮助您开始学习基础知识。感谢您的回复。您能否详细说明一下如何在login.aspx中的代码中使用sql语句