Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does the MVC3 default template store user-account information?

Can you tell me where the asp.net mvc3 default template stores the login information when I register a new account? It is running local in debug mode.

Without having installed SQLExpress, the register function did not work at all. Since I have installed it, I can use the register/login function, but I can't find the table in SQLExpress where this kind of data is stored. There are master, model, msdb and tempdb in SQLExpress which are system databases.

Can you help me? Thanks!

like image 950
ceran Avatar asked Oct 15 '11 10:10

ceran


People also ask

What is @model in Cshtml?

The @model directive allows access to the list of movies that the controller passed to the view by using a Model object that's strongly typed. For example, in the Index.cshtml view, the code loops through the movies with a foreach statement over the strongly typed Model object: CSHTML Copy.

How pass data from database to view in MVC?

The other way of passing the data from Controller to View can be by passing an object of the model class to the View. Erase the code of ViewData and pass the object of model class in return view. Import the binding object of model class at the top of Index View and access the properties by @Model.

How model data is used in controller?

In Solution Explorer, right-click the Controllers folder and then click Add, then Controller. In the Add Scaffold dialog box, click MVC 5 Controller with views, using Entity Framework, and then click Add. Select Movie (MvcMovie. Models) for the Model class.


1 Answers

Take a look at the web.config.

<membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
             enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
             maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
             applicationName="/" />
      </providers>
    </membership>

So the plugged in membership provider is SqlMembershipProvider, using a connection string called ApplicationServices:

<connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

So if you look in App_Data in your project (file system), you'll see a file called aspnetdb.mdf, which is where your users are being stored.

Here's some more info on SQL Server Express.

like image 60
RPM1984 Avatar answered Oct 06 '22 13:10

RPM1984