会员提供者、IPrincipal、IIdentity?

发布于 2024-08-27 04:20:16 字数 483 浏览 10 评论 0原文

我有一个概念性问题...我正在为一家公司制作一个内联网应用程序(Web 平台)。我有一个包含这些表的 SQL Server 数据库:

Users (userID, userName, userPass, roleID)
Roles (roleID, roleName)
Pages (pageID, pageURL)
RolesXPages(pageID, roleID)

当用户浏览站点时,如何创建一个结构来存储所有这些信息的最佳方法是,我的意思是,在线程上我应该能够检查他的角色、他的页面(我一直在阅读,有很多东西让我感到困惑,我看到了 MembershipProvider、IPrincipal、IIdentity 等类,但我不确定什么对我来说应该是最好的。

任何想法...

提前致谢!

编辑: 每次都会变得更加混乱...我只想在运行时处理这些结构,并能够在页面回调或更改页面期间保持状态...

I have a conceptual question... I am making an Intranet application (Web platform) for a company. I have a SQL Server DB with these tables:

Users (userID, userName, userPass, roleID)
Roles (roleID, roleName)
Pages (pageID, pageURL)
RolesXPages(pageID, roleID)

How is the best way to create a structure to store all this information while the user navigates the site, I mean, on the thread I should be able to check his role, his pages (the ones he can access) I have been reading and there is a lot of stuff there where Im confused, I saw the MembershipProvider, IPrincipal, IIdentity, etc classes but Im not sure what should be the best one for me.

Any thoughts...

Thanks in advance!

Edit:
Everytime gets more confusing... I just want to handle those structures at runtime and be able to mantain state during page callbacks or changing pages...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

盗梦空间 2024-09-03 04:20:16

我一般使用MembershipProvider、RoleProvider和ProfileProvider。听起来它可以解决你所有的问题。

https://web. archive.org/web/20211020202857/http://www.4guysfromrolla.com/articles/120705-1.aspx

MembershipProvider 允许您使用许多内置的 asp.net 控件,如登录、登录状态、用户向导。

RoleProvider 允许您创建和管理哪些成员资格用户处于哪些角色,并且您可以使用 web.config 管理对应用程序不同区域的访问。

ProfileProvider 允许您从根本上扩展成员资格用户帐户,以将您希望添加到其帐户的任何属性。

I generally use MembershipProvider, RoleProvider and ProfileProvider. It sounds like it would solve all of your problems.

https://web.archive.org/web/20211020202857/http://www.4guysfromrolla.com/articles/120705-1.aspx

The MembershipProvider allows you to use a number of built in asp.net controls like login, loginstatus, userwizard.

The RoleProvider allows you to create and manage which membership users are in which roles and you can manage access to different areas of your application using web.config

The ProfileProvider allows you to basically extend the Membership users account to add whatever properties you wish to their account.

So要识趣 2024-09-03 04:20:16

如果您正在构建全新的东西,我认为您应该查看内置的 会员资格和ASP.NET 中的角色系统,特别是 Sql Server Role Provider。

If you are building something completely new I think that you sould look at the builtin membership and role system in asp.net, especially the Sql Server Role Provider.

泪是无色的血 2024-09-03 04:20:16

对于 ASP.NET 会员资格,您将需要针对 asp.net MembershipProvider 模型进行编码。
如果可以的话,我会放弃使用任何自定义代码进行身份验证和角色,并使用现有的提供程序模型。然后编写一些自定义代码来处理页面级访问。

IPrincipal 非常简单,如果您必须使用您列出的自定义表,它可能会更快。
希望有帮助

With ASP.NET membership you will want to code against the asp.net MembershipProvider Model.
If you can, I would ditch using any custom code for authentication and roles and use the existing provider model. Then write some custom code to handle the page level access.

IPrincipal is pretty bare bones and it may be quicker if you have to use the custom tables you listed.
Hope That Helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文