How to make Membership, Profile and other built in API to use SQL Server 2000 instead of SQL Express.
Hi

ASP.NET 2.0 comes with some great API’s like Membership, Roles API, Profile API, health monitoring API. Etc. These API use the default providers to store data. Like the Membership API uses the SQL Express database by default to store the data. But many a time you want to use other database. I wanted to store the Membership and profile data in the SQL Server 2000 database.

With ASP.NET 2.0 Provider model this can be done in a few steps.

First we create a new database and obtain its connection string.

Next configure the database with ASP.NET schemas. To do these use the aspnet_regsql.exe which is located at C:\WINDOWS\Microsoft.NET\Framework\v2.0.xxxxx directory. Use the wizard to create the schema, tables and stored-procedures for built in SQL provider of ASP.NET 2.0.

Now store the connection string in connection string section of the Web.Config.

ASP.NET 2.0 ships with a built-in connection string called “LocalSqlServer” which by default uses SQL express Database. You need to replace this connection string with your new connection string.

<connectionStrings>

        <remove name="LocalSqlServer"//>

        <add name="LocalSqlServer" connectionString="Data Source=Datasource;Initial Catalog=DatabaseName;Integrated Security=True" providerName="System.Data.SqlClient"//>

    <//connectionStrings>

You can also change the connectionstring name from LocalSqlServer to something else and configure the existing provider to use this connection string

Hope this helps
Thanks
Vikram


Share this post   Email it

Feedback

Posted on 9/5/2006 11:30:04 PM

How do i configure Memebership API in MS Access Database ?

Posted on 9/7/2006 2:26:35 AM
Posted on 8/8/2007 12:25:54 PM

I have a connection to a SQL Server 2000 and I am trying to store info into the tables. What needs to be done to send the info from my code to the server. Also I do have a stored procedure I am using.
Thanks,
Tribal

Posted on 3/3/2008 9:16:05 AM

I have already created two connection strings in my web.config: one for local access and the other one for hosted access on the web.

What I'm looking for is a way switch from the local connection string to the hosting connection string within the "Load" code of the site's Default.aspx page.

Ben

Posted on 5/12/2008 11:56:56 AM

hey Vikram, i m not able to obtain Connection string.
when i try to run aspnet_regsql.exe file and try to select database by using drop-down menu next to it, i m getting error like "when connecting to SQL Server 2005 this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections."
Please help me if u can.
Thanks, sanjit.

Please post your comments:

Name:  
Email (optional): Your email address will not be posted.
URL (optional):
Comments: HTML will be ignored, URLs will be converted to hyperlinks  
Enter the text you see in the box:
 

Copyright © 2006 - 2012 Vikram Lakhotia