ASP MVC4管理员添加用户设置 [英] ASP MVC4 Admin add user settings

查看:228
本文介绍了ASP MVC4管理员添加用户设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚学这个在网站管理工具在管理方面,已经成立了一个新的项目。我已访问在后端的安全面板,并创建了管理员角色,这是用来通过控制器滤波器访问的图。所有标准的东西。

I am just learning the admin side of this in the Web Site Administration Tool, having set up a new project. I have accessed the security panel at the back end, and created an admin role, which is used to access a view through a controller filter. All standard stuff.

然而,当我尝试登录到与该用户的前端,它不存在,我必须重新创建它。

However when I try to log in to the front end with this user, it doesn't exist, and I have to create it afresh.

另外,当我创建在前端的用户,并试图指派他在后端它他也没有存在的管理角色。

Alternatively when I create a user at the front end, and try to assign him an admin role at the back end it he also doesn't exist.

只有在后端创建的用户,在后端存在和可分配的角色

Only users created at the back end, exist at the back end and can be assigned roles

有似乎是前端用户和后端用户之间没有任何联系。似乎存在两个单独的数据库一个​​保持前端用户和一回终端用户。

There seems to be no connection between front end users and back end users. There appears to be two separate databases one holding front end users and one back end users.

给人一种后台用户管理员权限似乎并没有从前端工作。

Giving a backend user admin rights doesn't seem to work from the front end.

有没有这个系统是如何工作的周围的一些解释?我用谷歌没有帮助。

is there some explanation on how this system work around? I have used google without help.

推荐答案

如果您使用的是标准的asp.net的MVC 4应用程序,然后肯定的。这是可以预料的。

If you're using a standard asp.net mvc 4 application, then yes. This is to be expected.

原因在于MVC4默认用户名为SimpleMembership一个不同的会员供应商,此提供程序不与ASP.NET配置实用程序兼容。该配置实用程序使用旧的会员提供者,它拥有完全不同的表。

The reason is that MVC4 by default users a different membership provider called SimpleMembership, and this provider is not compatible with the ASP.NET Configuration utility. That configuration utility uses the old membership provider, which has entirely different tables.

您的选项有:


  1. 请不要使用网络配置工具。手动添加用户,或通过脚本,或者创建自己的管理页面。

  2. 禁用简单的会员,这样MVC使用旧会员制

  3. 做一些完全不同的(不要使用会员,使用不同的供应商,建立自己的供应商,等...)

作为一个单独的数据库,是的。如果您发现,没有在你的web.config没有会员的配置。相反,ASP.NET Congifuration实用程序将使用在你的machine.config中定义的默认成员配置C:\\ WINDOWS \\ microsoft.net \\框架[64] \\ CONFIG 。默认位置是位于项目目录称为aspnet.mdf

As for a separate database, yes. If you notice, there is no membership configuration in your web.config. Instead, the ASP.NET Congifuration utility uses the default membership configuration that's defined in your machine.config in c:\windows\microsoft.net\framework[64]\config. the default location is a file located in your project directory under the App_Data directory called aspnet.mdf

编辑:

有关新的供应商在这里更多信息:

More information about the new provider here:

<一个href=\"http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx\" rel=\"nofollow\">http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx

还有:

http://geekswithblogs.net/Aligned/archive/2012/08/30/mvc-4-authentication.aspx

这篇关于ASP MVC4管理员添加用户设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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