如何将LogIn标识为Admin或Normal用户 [英] How to identify LogIn as a Admin or Normal user

查看:221
本文介绍了如何将LogIn标识为Admin或Normal用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..

我创建了应用程序,其中我开发了LogIn相关表单,但我想将LogIn识别为Admin或简单用户以及如何基于他的角色区分或重定向用户具体表格

我在SQL-Server中设计了表用户,但如何识别具体。角色或用户?

请帮帮我..如果这个问题不合适那么更新它

谢谢

Hi guys..
I am created Application ,In which i developed LogIn a related form,But i want to identify LogIn as Admin or simple user And how distinguish or redirect user based on his role to specific form
I designed Table User in SQL-Server but how to identify specific.Role or User??
Help me please..If this question is not appropriate then update it
Thank you

推荐答案

查看这篇文章。它将为您提供如何实现与安全相关的详细信息。



通过ASP.NET中的角色验证用户 [ ^ ]
Look into this article. It will give you the idea how to implement security related details.

Authenticate User by Roles in ASP.NET[^]


我创建了角色表

1.RoleID

2.RoleName //管理员或普通用户或我们可以添加的角色名称是什么

3.活动位//对于真或假



我在用户表中将此RoleID作为FK传递


并以登录表格



if(LoginMsg [2] .ToString()==Admin)//如果管理员登录,那么

{

Session [UID] = LoginMsg [1] .ToString();

Session [ADMINID] = LoginMsg [1] .ToString();

Response.Redirect(重定向页面管理部分,假;

}

其他//除管理员以外的其他用户

{

会话[ UID] = LoginMsg [1] .ToString();

Response.Redirect(重定向页面用户页面,false);

}
I created Role table
1.RoleID
2.RoleName //Admin Or Normal User or what is the role name we can add it
3.Active bit // for true or false

I pass this RoleID in User Table as a FK

and in In login Form

if (LoginMsg[2].ToString() == "Admin") //If admin logs in then here
{
Session["UID"] = LoginMsg[1].ToString();
Session["ADMINID"] = LoginMsg[1].ToString();
Response.Redirect("Redirecting page of Admin Section", false);
}
else //Other user than admin
{
Session["UID"] = LoginMsg[1].ToString();
Response.Redirect("redirecting page user page",false);
}


我真的比感谢并且感谢Rohan Leuva和ArunRajendra帮助我的人
I really thanxx and Appreciate the people Rohan Leuva and ArunRajendra who help me


这篇关于如何将LogIn标识为Admin或Normal用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆