处理多个会员提供商的身份验证
我有一个网络应用程序,使用自定义会员资格提供程序来访问管理和库存页面,每个页面都位于不同数据库表中的不同用户的单独文件夹中(因此是自定义会员资格提供程序)。
根目录和其他文件夹中还有供访客访问的其他页面。
我有一个用于管理员和根目录中的库存部分的登录表单,它调用适当的会员提供程序进行身份验证,并在成功登录后重定向到相应的页面。
由于我可以在 Web 配置中拥有 1 个身份验证表单条目,因此如何设置应用程序以发送到正确的登录表单? (就像 httpApplication.Authorize 事件)
我的第一个想法是有一个 HttpModule 来检查路径,如果清单或管理文件夹位于路径中并且用户未经过身份验证,则将用户重定向到登录页面。
这是最好的方法吗? 还有别的办法吗?
谢谢
I have a web app using custom membership providers to access admin and inventory pages, each in a separate folder for different users from different database tables (hence the custom membership providers).
There are other pages in the root and other folders which are for guest visitors.
I have a login form for the admin and the inventory sections in the root which calls the appropriate membership provider for authentication and redirects to the corresponding page upon successfuly login.
Since I can have 1 authentication form entry in the web config, how can I set up the app to send to the correct login form?
(like an httpApplication.Authorize event)
My first thought was to have an HttpModule that checks the path and if the inventory or admin folders are in the path and the user is not authenticated then redirect the user to the login page.
Is that the best approach? Is there another way?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在每个受保护的文件夹中都有一个 web.config 文件,并且每个文件都引用自己的登录页面和成员资格提供商。 这比尝试决定在单个表单上使用哪个提供程序要简单得多。
You could have a web.config file in each of your protected folders, and each referencing its own login page and membership providers. This would be much simpler than trying to decide which provider to use on a single form.