ASP.Net MVC、基于角色的安全性和其他基于人员的数据
我有一个 ASP.Net MVC 应用程序,并且在 SQL Server 中使用表单身份验证。这为我设置了身份验证和授权。但是,我还需要跟踪其他基于人员的数据,例如人员的电话号码、部门、收费率、开始日期等。
人员可以做什么(由 ASP.Net 控制)安全性)与他们是谁有关(由我的应用程序控制)。
是否有将 ASP.Net 与我的应用程序数据链接以获得更完整的人员对象的最佳实践?我可以简单地扩展 ASP.Net 表中的信息吗?是不是把它分开比较好?有人有任何提示或指导链接吗?
I have an ASP.Net MVC application and I'm using Forms authentication in SQL Server. This sets up the authentication and authorization for me. However, I have other person-based data that I need to track as well, such as the person's phone number, department, their charge-out rate, start date, etc.
WHAT the person can do (which is controlled by ASP.Net security) is related to WHO they are (which is controlled by my application).
Is there a best practice for linking ASP.Net with my application data to get a more complete person object? Can I simply extend the information in the ASP.Net tables? Is it better to keep it separate? Has anyone got any tips or links for guidance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您已经在使用 ASP.NET 表单身份验证,因此 ASP.NET RoleProvider 可以通过 授权属性也同样易于设置。
你会得到这样的结果:
如果你确实使用了所有这些,还有 ProfileProvider for ASP.NET,它为您生成配置文件代码,并提供完整的智能感知支持。您可以自定义您想要的字段以及应存储的数据类型等。
角色提供程序和配置文件提供程序都可以自定义或自定义,互联网上有很多文章会告诉您如何操作。
使用 ASP.NET 提供程序还为您带来了以下好处:数据在整个 ASP.NET 请求处理管道中自动维护,例如,您可以访问此属性:
...几乎从任何地方。
Since you are already using ASP.NET Forms Authentication the ASP.NET RoleProvider which can be integrated into MVC via the Authorize attribute is just as easy to setup.
And you get something like this:
And if you did use all that, there's also the ProfileProvider for ASP.NET which generates profile code for you with full intellisense support. You can customize which fields you want and what data types it should be stored in etc. etc.
Both the Role Provider and Profile Provider can be customized or roll-your-own, there are many many articles on the internet that will tell you how.
Using the ASP.NET providers also gives you the benefits that the data is maintained automatically throughout the ASP.NET request processing pipeline, e.g. you can access this property:
...from almost anywhere.
使用配置文件属性的内置功能来存储有关的其他数据您的用户。
Use the built-in functionality for Profile Properties to store additional data about your users.