简体   繁体   English

使用Membership.CreateUser时数据在哪里保留?

[英]Where is data persisted when using Membership.CreateUser?

I am working on a .NET MVC 3, razor site and I want to know where data is persisted when using Membership.CreateUser? 我正在.NET MVC 3,剃须刀网站上工作,我想知道使用Membership.CreateUser时数据在何处持久化?

On http://msdn.microsoft.com/en-us/library/d8t4h2es.aspx it says: http://msdn.microsoft.com/zh-cn/library/d8t4h2es.aspx上,它显示:

CreateUser adds a new user to the data store and returns a MembershipUser object for the newly created user. CreateUser将新用户添加到数据存储中,并为新创建的用户返回MembershipUser对象。

Which data store is that? 那是哪个数据存储区? The local .sdf file in App data does not have any tables for user credentials? App数据中的本地.sdf文件没有用于用户凭据的任何表吗?

Also feel free to provide some good links on helping me understand the .NET MVC3 security model. 也可以随时提供一些很好的链接来帮助我了解.NET MVC3安全模型。

By default, it uses a store in App_Data, creating an ASPNETDB.mdf file, at least in web forms. 默认情况下,它使用App_Data中的存储,至少以Web形式创建ASPNETDB.mdf文件。 The behaviour would be the same for MVC, with the exception of the creating the DB automatically part. 对于MVC,其行为将是相同的,除了自动创建DB部分之外。 You can use the aspnet_regiis tools to generate the tables it needs in any SQL database, or roll your own provider, and update the membership registration in the <system.web><membership> element as you did in web forms.. 您可以使用aspnet_regiis工具在任何SQL数据库中生成它所需的表,或者滚动自己的提供程序,并像在Web表单中一样在<system.web><membership>元素中更新成员资格注册。

You need to set up a membership database. 您需要设置一个成员数据库。

If this doesn't exist you can do it manually by following the steps on this blog 如果不存在,则可以按照此博客上的步骤手动进行

You need to run the aspnet_regsql.exe utility and follow the steps in the wizard. 您需要运行aspnet_regsql.exe实用程序,并按照向导中的步骤进行操作。 This will create the various tables you need. 这将创建您需要的各种表。

More information from the MSDN 来自MSDN的更多信息

ASP.NET membership gives you a built-in way to validate and store user credentials. ASP.NET成员资格为您提供了一种内置的方式来验证和存储用户凭据。

The default provider stores membership information in a Microsoft SQL Server database. 默认提供程序将成员资格信息存储在Microsoft SQL Server数据库中。

As far as I know, the bundled security model in ASP.NET MVC 1.0 and 2.0 based on ASP.NET Membership API .So there is no special security API for ASP.NET MVC itself. 据我所知,ASP.NET MVC 1.0和2.0中的捆绑安全模型基于ASP.NET Membership API 。因此,ASP.NET MVC本身没有特殊的安全API。 it is based on existing ASP.NET Membership 它基于现有的ASP.NET成员资格

And when you install membership you are creating custom tables and stored procs. 并且,当您安装成员资格时,您将创建自定义表和存储的proc。 So The user you mentioned should be stored on SQL Database. 因此,您提到的用户应存储在SQL数据库中。

From this link you can see after the installation there shold be aspnet_users table which is users stored. 这个链接,您可以在安装后看到有应和其存储用户aspnet_Users表格

I dont know if there is a security API for ASP.NET MVC 3.0 because I have removed ASP.NET Membership classes shipped with ASP.NET MVC long time ago and I have implemented myself. 我不知道是否存在用于ASP.NET MVC 3.0的安全API,因为我很早以前就删除了ASP.NET MVC附带的ASP.NET Membership类,并且已经实现了自己。

Also I strongly recommed to remove ASP.NET MVC membership classes if User has a special meaning and has other properties other than just a username/password in your problem domain. 另外,如果用户具有特殊含义并且除了问题域中的用户名/密码以外还具有其他属性,我强烈建议删除ASP.NET MVC成员资格类。

when setting up your membership provider you will run a regsql command that will create the schema in your data store (whatever store you are using) and put the connection string in your web.config. 设置成员资格提供程序时,您将运行regsql命令,该命令将在数据存储区(无论您使用的是哪种存储区)中创建架构,并将连接字符串放入web.config中。 You could use any datastore that .Net has a provider for (ORACLE, MYSql, SQLite, SQL Server, MS Access, etc). 您可以使用.Net具有提供程序的任何数据存储(ORACLE,MYSql,SQLite,SQL Server,MS Access等)。

You can still interact with the built-in MS Membership classes and functions from your MVC project using something like the MvcMembership starter Kit DLL's. 您仍然可以使用MvcMembership入门工具包DLL与MVC项目中的内置MS Membership类和函数进行交互。

https://github.com/TroyGoode/MembershipStarterKit https://github.com/TroyGoode/MembershipStarterKit

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Membership.CreateUser适用于多个会员提供商 - Membership.CreateUser for multiple Membership Providers 对Membership.CreateUser抛出“没有错误。” - “No Error.” thrown on Membership.CreateUser 扩展Membership.CreateUser方法的参数 - Extending parameters for Membership.CreateUser method CreateUserWizard的哪种方法称为Membership.CreateUser? - What method of CreateUserWizard calls the Membership.CreateUser? ASP.Net在调用Membership.CreateUser()时设置正确的连接字符串 - ASP.Net Setting the correct Connection String when calling Membership.CreateUser() 通过Membership.CreateUser创建用户时,是否有一个.NET包装器可以设置用户的地址,城市,州,邮政编码等? - When creating a user by Membership.CreateUser, is there a .NET wrapper that can set the user's address, city, state, zip, etc.? ASP.NET MVC 3 单元测试 Membership.CreateUser 总是返回 MembershipCreateStatus 错误 - ASP.NET MVC 3 unit tests for Membership.CreateUser always return MembershipCreateStatus error 成员资格CreateUser和相关表 - Membership CreateUser and related tables 使用IReliableDictionary2时,何时将数据持久保存到磁盘? - When is data persisted to disk when using IReliableDictionary2? C#成员资格多个提供程序createuser错误 - C# membership multiple providers createuser error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM