Link to home
Start Free TrialLog in
Avatar of CoopIS
CoopIS

asked on

Using the same membership for multiple websites in asp.net

Background:
I have four websites that allow users to enter information into different tables in a  database. Now I need to restrict access to the pages in each website.  I want to set up one membership that each webiste can use.

Currently:
I've set up a membership for logging in to website 1.  I used the asp.net configuration in the solution explorer (to automatically create the ASPNET.MDF), and added several users.  The log in controls (log in / log out / change password) work fine on website  1.

Now I would like for website 2 to use the same login database to log in and change passwords etc.  I added the connection to the membership database in the server explorer, but I'm not sure what I'm supposed to do with the web.config file in order for my log in controls in website 2 to use the membership from website one.  

My web.config file in website 1 just displays the connection string to my data entry database:

<connectionStrings>
    <add name="myConnectionString" connectionString="...string info here......"
</connectionStrings>

The web.config in website 2 displays the connection strings to the data entry database and the new aspnet database:

<connectionStrings>
    <add name="myConnectionString" connectionString="...string info here......"
    <add name="ASPNETConnectionString" connectionString="...string info here......"
</connectionStrings>

I added login controls to website 2, but they are unable to retrieve the log in information from the ASPNET database.


Any help is appriciated,

Thanks
Avatar of Alan Warren
Alan Warren
Flag of Philippines image

<listening>
Hi,

You have to keep the database in common location and accessed by the two web application!

So you cannot keep the database in App_Data folder of one web application!

Hope it helps u...
ASKER CERTIFIED SOLUTION
Avatar of Alan Warren
Alan Warren
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CoopIS
CoopIS

ASKER

Thanks for all the responses.  I don't have sql server management studio on my current computer, am I am unable to run aspnet_regsql.exe.

I will have to wait to test this until later this week when I get my new computer at work with SSMS.


Cooper IS
Avatar of CoopIS

ASKER

Thank you Alan.

 I just got my new pc with ssms on it and was able to use the same membership database on all my websites by following your instructions.

Cooper IS