在不同的区域成员的ApplicationName提供 [英] Membership provider with different ApplicationName in area
问题描述
我有一个的web.config
在我MVC3应用程序中,我有一个管理
区在我MVC3应用太
在前端钩我的用户asp.net成客户
表和我的应用程序依赖于该表进行操作。在管理
区我有一个管理员角色
和用户
但此登录也适用于前端。我可以为我的管理
所以我的应用程序不会失败,但我非常希望到登录从前面分离管理客户code>区域。
我希望把第二个的web.config
具有不同的应用程序名称,使我的管理
区域内管理员帐号不能登录到前端。例如。
<型材>
<供应商>
<清/>
<添加名称=AspNetSqlProfileProviderTYPE =System.Web.Profile.SqlProfileProvider的connectionStringName =SecurityConn的applicationName =//>
< /供应商>
< / profile文件>
但我不知道在哪里把这个,或者如果它甚至有可能
的applicationName =/ AdminArea
您可以在不同的applicationName的部分添加多个提供商。
你将需要考虑的是你的供应商之间怎样切换。
您可以使用供应商集合例如
Membership.Providers [MyOtherProvider]的ValidateUser(用户名,PWD)。
所以,你需要一种机制来知道谁是(管理员或客户)。记录
I have a web.config
in my MVC3 application, I have an Admin
area in my MVC3 application too.
On the front end I hook asp.net users into a Customers
table and my application relies on this table to operate. In the Admin
area I have an Administrator Role
and User
but this login also works for the front end. I can create a customer for my Admin
so my application doesn't fail but ideally I would like to separate the logins from the front and Admin
area.
I want to put a second web.config
inside my Admin
area that has a different application name so that the Admin account can never be logged into the front end. e.g.
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SecurityConn" applicationName="/" />
</providers>
</profile>
But I don't know where to put this or if it is even possible
applicationName="/AdminArea"
You can add more than one provider in the section with different applicationname.
What you will need to consider is how you would switch between those providers. You can use the providers collection e.g.
Membership.Providers["MyOtherProvider"].ValidateUser(username, pwd);
So you will need a mechanism to know who is logging in (Admin or customer).
这篇关于在不同的区域成员的ApplicationName提供的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!