ASP.NET Web 应用程序中用户管理的替代方法
我使用的是asp.net 2.0。我一直在使用 ASP.NET 会员资格提供程序进行用户管理。但我认为如果我可以在不使用 ASP.NET 中提供的角色和成员资格提供程序的情况下执行此操作,这会更有效。事实上,当我添加登录控件时,我看到生成了大量标记, 在 ASP.NET 网页中创建用户控件等。
我所说的用户管理是指 ASP.NET Web 应用程序中的整体登录、用户活动跟踪、密码重置/检索、角色管理。我想实施有效的方法来实现这一目标。
任何建议将不胜感激。
I am using asp.net 2.0. I have been using asp.net membership provider for user management. But I think this would be more efficient if I could do this without using role and membership provider provided in asp.net. In fact I see bulky markups generated when I add login control,
createuser control etc. in an asp.net web page.
By saying user management, I am referring to the overall login, user activity tracking, password reset/retrieval, role management in an asp.net web application. And I want to implement efficient way to accomplish this.
Any suggestion would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
到底是什么让您烦恼?服务器端代码,还是提供给客户端的 HTML?
如果是前者,那么您可以实现自己的提供程序,或者从头开始重新发明整个系统(我不建议这样做,但在某些情况下可能是值得的)。
如果是后者,只需编写您自己的一组使用 Membership API 的控件即可。
就“效率”而言,你不清楚“效率”对你来说意味着什么。
What exactly bothers you? Server-side code, or the HTML which gets served to the client?
If former, then you can implement your own providers or just reinvent the whole system from scratch (which I do not recommend, but it might be worth it in some scenarios).
If latter, just write your own set of controls that use Membership API.
As far as "efficiency" is concerned, you're not clear in what "efficient" means to you.
大多数(全部?)成员资格控件都支持模板,这意味着您可以自定义它们为客户端生成的标记。
请参阅本教程以开始使用:ASP.NET 控件开发速成课程:模板属性
至于数据库命中,我认为这不是一个大问题,但如果您担心的话,我建议对其进行负载测试以确保。另外,如果您设置 CacheRolesInCookie如果为 true,您可以消除其中一些数据库调用。
Most (all?) of the membership controls support templates, which means you can customize the markup they generate to the client.
See this tutorial to get you started: A Crash Course on ASP.NET Control Development: Template Properties
As for the database hits, I don't think it's a huge problem, but if you're concerned I'd suggest load testing it to make sure. Also, if you set CacheRolesInCookie to true, you can eliminate some of those database calls.