ASP.NET MVC4 WebSecurity - 数据库存储位置

时间:2021-11-08 17:20:27

I just installed MVC 4 and made a default internet project. I was able to create a username/login/change password.

我刚刚安装了MVC 4并制作了一个默认的互联网项目。我能够创建用户名/登录/更改密码。

In MVC 3, after creating a user, I would see an ASPNETDB.MDF file in the App_Data folder, and I would also be able to manage users/roles in the Website Administration Tool.

在MVC 3中,在创建用户之后,我会在App_Data文件夹中看到一个ASPNETDB.MDF文件,我也可以在网站管理工具中管理用户/角色。

with MVC 4, I do not see an ASPNETDB.MDF file, even if i click show all files. Also, any new users created are not shown in the Website Administration Tool.

使用MVC 4,即使我单击显示所有文件,我也看不到ASPNETDB.MDF文件。此外,创建的任何新用户都不会显示在网站管理工具中。

Is there anywhere else I can look to retrieve users / set rolls ?

有没有其他我可以寻找检索用户/设置卷?

Thanks

谢谢

5 个解决方案

#1


2  

I'm not sure whether you could use "Website Administration Tool" with MVC4

我不确定你是否可以在MVC4中使用“网站管理工具”

Go to the Models folder and open AccountModeles.cs class.

转到Models文件夹并打开AccountModeles.cs类。

You will find the code,

你会找到代码,

public UsersContext()
            : base("DefaultConnection")
        {
        }  

Go to the web.config file See the connection string with the name DefaultConnection ,You can see the database where the User/Roles are stored in.

转到web.config文件查看名称为DefaultConnection的连接字符串,您可以看到存储用户/角色的数据库。

#2


1  

As far as I know, You have to Refresh your solution, Show All files and then look in the map App_Data. Perhaps you forgot to refresh?

据我所知,您必须刷新您的解决方案,显示所有文件,然后查看地图App_Data。也许你忘了刷新?

Also you can manually go to your .MDF file then drag it into Visual Studio. Then it will automatically open The server explorer where you can see the new users.

您也可以手动转到.MDF文件,然后将其拖到Visual Studio中。然后它将自动打开服务器资源管理器,您可以在其中查看新用户。

#3


0  

MVC 4 doesn't support the usage of Website Administration Tool as it uses WebMatrix's simple membership.

MVC 4不支持使用网站管理工具,因为它使用WebMatrix的简单会员资格。

This is suggested in this article

这是在本文中提出的

#4


0  

The membership provider in MVC 4 Internet applications, referred to as SimpleMembership, does not use the database ASPNETDB.MDF. You should find another database in the App_Data directory that is named using the convention aspnet-project name-999999999999.mdf, where "project name" is the name of the VS project it is created in and the number I believe uses date/time and maybe some other digits to make a somewhat unique id. You will find the user data in this database and it is not compatible with the website administration tool. You can find out more about the SimpleMembership database and customizing it in this post.

MVC 4 Internet应用程序中的成员资格提供程序(称为SimpleMembership)不使用数据库ASPNETDB.MDF。您应该在App_Data目录中找到另一个使用约定aspnet-project name-999999999999.mdf命名的数据库,其中“project name”是它创建的VS项目的名称,我认为它使用的是日期/时间和也许一些其他数字,以使一个独特的id。您将在此数据库中找到用户数据,但它与网站管理工具不兼容。您可以在本文中找到有关SimpleMembership数据库的更多信息并对其进行自定义。

#5


0  

Open the web.config file in your solution to check where and by what name the mdf file is created.

打开解决方案中的web.config文件,以检查mdf文件的创建位置和名称。

You should be able find your db details over here in the config file:

您应该可以在配置文件中找到您的数据库详细信息:

</configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source= ******>

With that, you can open the respective database on SQL server, to check the details you were looking for

这样,您可以在SQL Server上打开相应的数据库,以检查您要查找的详细信息

#1


2  

I'm not sure whether you could use "Website Administration Tool" with MVC4

我不确定你是否可以在MVC4中使用“网站管理工具”

Go to the Models folder and open AccountModeles.cs class.

转到Models文件夹并打开AccountModeles.cs类。

You will find the code,

你会找到代码,

public UsersContext()
            : base("DefaultConnection")
        {
        }  

Go to the web.config file See the connection string with the name DefaultConnection ,You can see the database where the User/Roles are stored in.

转到web.config文件查看名称为DefaultConnection的连接字符串,您可以看到存储用户/角色的数据库。

#2


1  

As far as I know, You have to Refresh your solution, Show All files and then look in the map App_Data. Perhaps you forgot to refresh?

据我所知,您必须刷新您的解决方案,显示所有文件,然后查看地图App_Data。也许你忘了刷新?

Also you can manually go to your .MDF file then drag it into Visual Studio. Then it will automatically open The server explorer where you can see the new users.

您也可以手动转到.MDF文件,然后将其拖到Visual Studio中。然后它将自动打开服务器资源管理器,您可以在其中查看新用户。

#3


0  

MVC 4 doesn't support the usage of Website Administration Tool as it uses WebMatrix's simple membership.

MVC 4不支持使用网站管理工具,因为它使用WebMatrix的简单会员资格。

This is suggested in this article

这是在本文中提出的

#4


0  

The membership provider in MVC 4 Internet applications, referred to as SimpleMembership, does not use the database ASPNETDB.MDF. You should find another database in the App_Data directory that is named using the convention aspnet-project name-999999999999.mdf, where "project name" is the name of the VS project it is created in and the number I believe uses date/time and maybe some other digits to make a somewhat unique id. You will find the user data in this database and it is not compatible with the website administration tool. You can find out more about the SimpleMembership database and customizing it in this post.

MVC 4 Internet应用程序中的成员资格提供程序(称为SimpleMembership)不使用数据库ASPNETDB.MDF。您应该在App_Data目录中找到另一个使用约定aspnet-project name-999999999999.mdf命名的数据库,其中“project name”是它创建的VS项目的名称,我认为它使用的是日期/时间和也许一些其他数字,以使一个独特的id。您将在此数据库中找到用户数据,但它与网站管理工具不兼容。您可以在本文中找到有关SimpleMembership数据库的更多信息并对其进行自定义。

#5


0  

Open the web.config file in your solution to check where and by what name the mdf file is created.

打开解决方案中的web.config文件,以检查mdf文件的创建位置和名称。

You should be able find your db details over here in the config file:

您应该可以在配置文件中找到您的数据库详细信息:

</configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source= ******>

With that, you can open the respective database on SQL server, to check the details you were looking for

这样,您可以在SQL Server上打开相应的数据库,以检查您要查找的详细信息