Default login asp.net MVC3 - asp.net-mvc

Where is the login information (username, password) actually stored by using the default template from ASP.NET MVC application in VS2010? I mean, is it physically registered in a database, file or something else?

Upon registering the first user a database named ASPNETDB.MDF under the application’s
App_Data directory is created. This information was supplied by default in the root web.config file.

There is no default login. There is not even a database created when you start a new project. You need to register a new user by clicking on the Register link on the login page. When you register a new user you will be prompted to specify the username and password and a database file will be created in the App_Data folder. Now you can go ahead and login with the account you have just created. And by the way the same stands true for ASP.NET MVC 1.0 and 2.0 project templates.

If you can't see the database under App_data, try clicking "Show all Files" which is one of the icons at the top of the solutions explorer. Then the database will show under App_data as something like ASPNETD8.MDF.

Related

New ASP.Net project but asking to sign in

I created a new ASP.net core project using VS2019. I did not modify anything from the automatically created weatherforecast controller. My problem is, everytime I just try to debug, the browser pops up asking me to sign in. Is there a default user and password created? How to solve this?
It is probably you are using Windows Authentication while create your Asp.NET project, try uncheck Authentication it will allow getting into the landing page of your application
Make sure that during the creation of the project you didn't add authentication. There's an option to add authentication by default.

ASP.net MVC: Creating a Simple Log-in Form in Visual Studio

I'm creating a simple ASP.net MVC login form using individual user accounts. I created the project following this tutorial: https://learn.microsoft.com/en-us/aspnet/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on
At what point do I connect it to my SQL Server database? In the tutorial, it seems as though the database tables are created automatically, though I've never seen an option to enter my database credentials.
Thanks!
The default template generates you a local database that is stored in the project directory. If I recall correctly, it does not require authentication. You can examine the Web.config file to see the connection string. It will not contain a username and password because it does not require them for that local database.

How to create new project with own database and authentication

I am trying to create a new web MVC project in Visual Studio 2015. I want to use my own database which already exists, and I want to add authentication models and controllers when creating the project.
The issue is:
When I create a new MVC project I can choose the type of authentication but I can't choose what database it uses. So the project is being created with its own local database while I want to use mine so that all necessary tables and DB objects are created in my own database.
I can't even find the LocalDB file created with the project to export the authentication data to my own database.
When I try to connect to the DB it asks me to browse for the mdf file and I have no clue where the file has been created. I did a search in Explorer for the mdf file but found nothing.
I got how to make it working! In case someone has the same problem these are the steps:
Visual Studio creates the defaultConnection - Yes.
But it doesn't create the tables (or probably even the database itself).
So I did the following:
Installed the project (ASP.NET Core Web Application with Framework template) using Individual User Accounts option as authentication.
Then went to appsettings.json and changed the connection string for my own database. (There is no needs to create asp auth tables, only have your own database ready)
I clicked debug and got the website displayed.
Clicked register and registered new user - I got the screen with button to do the migration.
I clicked the button and refreshed the page.
Went to my database and saw all tables have been created in there and the user inserted in the database.
I hope this helps anyone.

Account model in MVC app doesn't work after deployment

I have an MVC app that I deployed to test on my machine (IIS on XP). I am unable to login using credentials I have set up using the ASP.NET configuration. Everything works fine before I published app. After typing in my username and password, the app doesn't seem to recognize it and gives the follwoing error message
![enter image description here][1]
By default, a new MVC project is configured to use the Membership Provider with SQLExpress using a file called aspnetdb.mdf in your App_Data folder. When you published, did that file make it to the destination?
To verify this is the issue, check your web.config. Look for the membership tag and the providers tag underneath that. Locate the AspNetSqlMembershipProvider provider and check its connection string. It will likely say ApplicationServices if you haven't changed it from the default. Then, check the ConnectionStrings node in your web.config to verify what database the Membership Provider is trying to use and where it's located.

How to edit the user details stored in aspnetdb without asp.net web administration tool?

I have asp.net MVC application which uses asp.net membership. I configured the user details from local system using Asp.Net web site administration tool. Now I have deployed the site in server and I need to change the password. Now I have the ASPNETDB.MDF file in the App_Data folder.
How to edit the details?
Adding ASP.Net MVC Membership Starter Kit to your project is a great place to start, if you see ongoing edits being required.
You could do one of a couple of things. You can copy the MDF from the site to the local machine, and then change the details there, then copy the MDF back over, or you can implement a web page that changes the password using the SqlMembershipProvider.ChangePassword method.
You must call the method MembershipProvider.ChangePassword. See http://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.changepassword.aspx.

Resources