I have created a sample web application in Visual Studio 2010. It stores Membership data(users, roles etc) in a .mdf file in App_data folder. But I don’t wanna do this. I wanna store data in SQL server database.
For that I Google a lot but could not find solution. Here is what I am doing so for. First I create application then by using Web configuration tool I set users, roles etc and when hit provider tab it throws following error:
Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.
Then I execute aspnet_regsql utility and created a database in SQL Server and again open web configuration tool but error is same, no change.
Please guide either i am going in right direction or not. If right then how can I store data in aspnet_regsql generated SQL server database?
Note that I am using .NET framework 4, SQL server 2008 R2, Visual studio 2010. In fact I was expecting that there will be connection string in web.config file just like other data driven controls do. But no entries go in web.config file.
Well normally the asp.net membership is used for sqlserver for big applications. first go to the web.config and comment the connection string already there and add a connection string that connects to the sqlserver and the cataloge name.
replace it with
then configure normally in the aspnet_regsql. and this will do the drill for sure.