Monday, April 28, 2008

ASPNETDB Problem: Unable To Connect To Sql Server Database

Sometimes trying to implement security in website using website administration tool this error may occurred by saying “Unable to connect to sql server database”. Before going to see the problem we need to discuss about how to create administrative user.

To create an administrative user

Run the web site once before proceeding. This ensures the initialization of the Membership and Roles databases.

In the Website menu, click ASP.NET Configuration.

Click the Security tab.

When first time showing this error I created ASPNETDB database in sql server database using regsql utility in windows\\Framework\v2.0\50727 and now can see the ASPNETDB database in sql server. But now also I can see the same error as “Unable to connect to Sql server database”.

Then I tried to connect the application with the server. Now no problem in connecting to sql server database also. From the study to solve this error I realized some causes to occur this error.

Possible causes of this error are not giving role manager enabled correctly

In the web.config we need to put enable rolemanager enabled as true. For your reference I am giving my working web.config as giving in the



After giving the in the web.config if shows that error you may not give the connection correctly

To correct this Choose Data Store" button and go to “Provider” tab and click on to single provider. In the next page only one option remaining "AspNetSqlProvider". Select this
And click “Test” link.

Hope it will work fine. If any any “SQLExpress database file auto-creation error:” occurs Pls check that you have installed SQLEXPRESS database and
Its service is running correctly.

Wednesday, April 23, 2008

How to Create Aspnetdb, membership provider database using aspnet_regsql command - membership provider,role provider,profile provider

ASP.NET Membership

ASP.NET membership is a built in way to validate and store user credentials.And Asp.Net membership helps in user authentication in websites. We can implememt membershipprovider by Forms authentication and Login control.

Purppose Of Membeship provider

1. Create new user with username and password.

2. Storing membership information in Sql Server,Active directory etc.

3.Authentication of users. By using ASP.NET login control,ASp.NET usercreation wizard etc implement complete authentication system.

4.Fascilitate role management etc

The database used to access membership database is normaly created with name ASPNETDB.MDF. Here is how to install ASPNETDB database

ASPNETDB.MDF is membership provider database and is used for storing and retrieving
membership data from database and here we are going to see how to create membership provider database . The command used to create Aspnetdb.mdf is ASPNET_RegSQL.EXE

1.Start->Programs->Microsoft visual studio 2005->visual studio tools->Visual Studio 2005 command prompt. Type ASPNET_RegSQL.EXE in the visual Studio 2005 command prompt

2. A wizard with the heading " Welcome To The Asp.Net Sql Server Wizard " will be displayed. Here need to click Next

3. Next a wizard with " Select Setup Option " will displayed. Now we need to select setup option “Configure sql server for application purpose is default”. Select which one you wants and next.

4. A window with " Select Sql Server Database " Will be shown Now we need to select our sql server database. Here needs to set server, authentication type and database.
If select the default name"aspnetDb.mdf" will be selected. If you wants to modify existing database select that database.

5.Now A confirm will be displayed with heading "Confirm your Settings". Now check servername and database name and click next.

6. A window with " The database Has Been Created Or Modified " Will displayed. Now click Finish

These all are how to create an membership database on sql Server 2005 database

1 – 1 of 1