ASP.NET Membership problem

Posted by Akiii under ASP.NET on 8/25/2011 | Points: 10 | Views : 2115 | Status : [Member] | Replies : 2
I want to use ASP.NET Membership feature in my website. ASP.NET Membership uses sqlexpress which result in a aspnetdb(default) created.
But, i have installed all the tables in sql server 2008 into database named "test_db" via aspnet_regsql.exe tool . Now, how to make my application to use sql server 2008 as the membership database....

Please if anyone knows, help me...!

Thanks and Regards


Posted by: Dhirendra on: 8/26/2011 [Member] Starter | Points: 25


add following setting in web.config file to configure your member ship provider.
once it is done...then launch Configuration application to create a user to access the can launch the configuration application by opening your application and clicking Configuration (Web Icon)
<add name="MemeberShipDBConn" connectionString="Initial Catalog=test_db;User ID=Dbusername;Password=password; data source=SQl serverName;Integrated Security=SSPI;" />

<membership defaultProvider="MySqlMembershipProvider">
<add name="MySqlMembershipProvider" connectionStringName="MemeberShipDBConn" type="System.Web.Security.SqlMembershipProvider"/>

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 8/26/2011 [Member] Bronze | Points: 25

Hi Itorian,
Thanks for the reply....

I have done what you suggested but still it is creating and using the default aspnetdb.mdf

Here i am giving you the steps that i have followed:-
(1) i have created an empty website(framework 4)
(2) created a default.aspx page(empty)
(3) copy pasted the code that you suggested in the web.config and changed the credentials
(4) then i used "aspnet_regsql.exe" tool to configure the membership in my sql server 2008 in the database named "test_db"
(5) i saved the project and open "aspnet configuration"
(6) there in the "provider" tab, there is no provider listed and it is saying "No providers created"
(7) in the security tab i created two roles "admin and user"
(8) i created two user also and assigned them specific roles
(9) i put a login control in the default.aspx page and build my project
(10) everything is running fine and also i am able to login, till here no problem !
(11) But the problem is that it is not using the sql server 2008 database, it has defaultly created a app_data folder and created a aspnetdb.mdf there.

Can you tell me where i am wrong and why it is still using the aspnetdb.mdf. I have already specified my connection string to sql server 2008...

I am totally confused regarding this..!

Please bail me out of here..
Thanks and Regards

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response