集合成员资格提供者使用特定的提供者 [英] Set Membership Provider to use a specific Provider

查看:121
本文介绍了集合成员资格提供者使用特定的提供者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的开箱即用的Asp.Net成员的功能来处理我的用户管理和角色管理。

I'm using the out of the box Asp.Net Membership functionality to handle my user management and role management.

我的应用程序包括为每个客户端的单一数据库,每个数据库都有自己的会员资格提供程序和角色提供者。

My application consists of a single database for each client and each database has its own Membership provider and role provider.

不过,也有谁的客户超过一个工作的一些用户,我想是使用单一登录,让他们选择要观看的客户端。我所拥有的一切设置使用存储所有用户名和一个关系到他们的客户有机会获得一个中间数据库,以促进这个客户端切换。我也有它的设置,以便在一个数据库中的任何更新一个用户将更新所有相应的用户在其他数据库。所有这些逻辑都工作得很好,但我似乎无法弄清楚如何告诉ASP.Net切换到一个特定的MembershipProvider,并使用一个。

However, there are some users who work for more than one of the clients and I want to be use a single login and let them choose which client to view. I have everything setup to facilitate this "client switching" by using an intermediate database that stores all usernames and a relation to which clients they have access to. I also have it setup so any updates to a user in one database will update all of the corresponding users in the other databases. All of this logic is working very well, except that I can't seem to figure out how to tell ASP.Net to change to a specific MembershipProvider and use that one.

我想我应该使用的过程如下(当用户切换客户端在客户端下拉菜单):

The process I thought I should use is as follows (when the user switches the client in the clients dropdown):


  • 请在当前用户退出

  • 告诉ASP.Net使用(根据所选的下拉选择在客户端上)
  • 哪些会员提供
  • 请在当前用户在使用选定的客户端的成员资格提供程序和刷新/重定向到他们时,他们改变了下拉列表中查看的页面

  • Log the current user out
  • Tell ASP.Net which Membership provider to use (selected based on the client chosen in the dropdown)
  • Log the current user in using the selected client's membership provider and refresh/redirect to the page they were viewing when they changed the dropdown

我知道如何去具体的成员提供(Membership.Providers [MembershipProviderName])的引用,但我不能找到如何告诉ASP.Net改变其成员提供的任何信息。我真的不甚至肯定asp.net登录控制它如何在后台或者 - 东西,可能会帮助我在这一切

I know how to get a reference to the specific membership provider (Membership.Providers[MembershipProviderName]), but I can't find any information on how to tell ASP.Net to change its membership provider. I'm not really even sure how the asp.net Login control does this in the background either - something that would probably help me out in all of this.

我一直很搜索和Web一段时间,似乎无法找到很多关于比那里的人都试图修改提供商元素的DefaultProvider属性在他们的Web.config几个线程做这等。

I've been searching SO and the web for awhile and can't seem to find much about doing this other than a few threads where people are trying to modify the DefaultProvider attribute of the Providers element in their Web.config.

推荐答案

此的 MSDN教程可以帮助你。

这篇关于集合成员资格提供者使用特定的提供者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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