I am trying to find out how I can add the membership database to my Mircroft SQL Server and then be able to reference it from a ASP.NET application. Basically, I created a new website app project, how do I create the asp_net membership database and then tell my website to comunicate to it?, I found this
http://msdn.microsoft.com/en-us/library/879kf95c.aspx
But that is not what i want, it creates a database file in the App_Code folder, I want it to access my Microsoft SQL Server and then there have such database. I am new to this setting up login merbership stuff and some pointers would be of great help. I thought maybe there was like a wizard where you could specify the server etc..?
Regards
There is a really nice Walkthrough of that here. You just need to use aspnet_regsql.exe to create the necessary objects in SQL Server and use Membership provider settings to use this new connection string, it is explained here under the Step 4: Specifying the Provider and Customizing Its Settings.
Hope that helps.
Cheers
Related
I would like to create a new IdentityServer4 for a .NetCore MVC Project without ASP-Authentication, which gets the users from an existing MS SQL-database.
The user database should not have to be changed, if not necessary.
Unfortunately, previous tutorials could not help me, because a lot has been revised.
What steps are necessary to achieve this?
Hope you can help me,
best regards
The Identity server i am currently working on used to connect to a MsSQL server database that contained legacy users. The identity server itself stored its own tables in its database. I believe the way it worked was it had its on UserDbContext added to the middelwere.
So what we had was.
Identity server database - clients and stuff
Legacy user database - All user data.
Which is close to what you are talking about
services.AddDbContext<UserDbContext>(builder => builder.UseSqlServer(settingsSetup.ConnectionStrings.UserDatabaseConnection));
Everything ran though a custom UserManager.
It no longer runs this way as over the summer i integrated all of the users to Asp .net core identity and the data now resides in the same database as the identity server.
I can dig around in the solution control old branches if you need more info.
I recently finished my asp website, bought the domain and azure hosting. Unfortunately, when I try to do anything that accesses the database I just get stuck on a loading screen. I just used the default asp razor mvc 5 project I think for the database along with a couple of custom tables.
So here is how I would do it since you have an existing database. I would follow azures website, and set up a SQL database. I would then script out the database on you local machine, and log into your azure database using SQL Server Express. Execute the script you generated from localDB. Then all of your data will be good to go. You will then need to take the connection string from azure, and put it in your applications config file. After modifying the connection string in your application you should redeploy, and verify everything is working the way you want. You will be able to verify your data is there in SQL Server Express.
Here is a link that may be of quite a bit of assistance to you. It includes step by step instructions as well as screen shots.
Another option is using this tool. I have never used it, but I know a few people who have had great success with it.
It seems MVC 5 no longer uses simple membership and I am having trouble figuring out how to use a SQL Azure database instead of the default .mdf file that is generated and saved on the web server. In simple membership it was as easy as changing two connection strings but that does not seem to be the case here. From what I have found online, it seems like I have to create my own custom storage provider to accomplish such a simple task. The only examples and docs I find online that deal with Azure are scenarios in which the developer wants to store in a non-relational setup or Azure Table storage.
Am I right in the above conclusion or is there something I am missing about integrating SQL Azure DB into my MVC 5 Asp.Net Identity app?
I have Identity running on top of a SQL Azure DB in one of my projects. You don't need to implement your own storage provider. The only thing you have to do is to change the connection string (normally named DefaultConnection) in your web.config file and point it to your SQL Azure DB.
I've got some silly questions, but I'm quite new in mvc and haven't found any appropriate answers,so:
1: In asp .net mvc4 internet application, as you create a new project VS. creates registration by default. If u register a new account, does mvc store this in a database? (I read that it stores, and can be found in appdata, but it's empty for me, and in server explorer there is no connetion, but I can log in and out after registration, it works perfectly.) Do I have to set a new sql server for VS or it handles this by itself? So how does this exactly work?
2: My goal is to modify the registration form to store id,name, fullname, email, registration date as you register. How can i achieve this by "extending" the default registration?
It does use a db. Check the connection string in web.config. VS 2010 uses SQL Express I believe and VS2012 uses localdb. SQL is installed with VS. The db file is usually installed in the app data folder but it does get generated until the first user is created. I suggest you get Microsoft SQL Management Studio if you want to look inside the DB, or use sever explorer from within VS.
This post perfectly answers to both of your questions
I've just created my first ASP.NET MVC app. Since I didnt choose to create an empty project, visual studio generated some views for me, including a register user page.
But what tables would i need to create to make use of the register/login-functionality?
Use the aspnet_regsql.exe tool to create your membership database.
http://msdn.microsoft.com/en-us/library/ms229862(v=vs.80).aspx
You actually don't need to create any user tables at all. Try and register and you'll see that the first time you do, it takes a little while to complete the operation. This is because the ASP.NET Membership table structure is being created for you.
However, in Visual Studio, you can go to Project->ASP.NET Configuration which will open a browser window for you to enable you to configure accounts more easily.
If you want to add the ASP.NET Membership tables to your own database, which allows you to add custom tables relating to and extending the functionality of the default membership, you can do so by following the steps in this answer.
You must use the ASP.NET Web Administration tools. Official instructions are provided for you here, including information about the database for your users/passwords.
http://www.asp.net/guided-tour/s27.aspx