Can you use the aspnetdb with 2 web sites

Posted on 2013-09-27
Medium Priority
Last Modified: 2013-10-21
I host a web site WEBSITEA that you login  using the aspnetdb database. I now need to host a second web site WEBSITEB that you login using the same login ID and password that you use for WEBSITEA. Is it possible to share the same aspnetdb database with both sites and how do I do that? I am using visual studio 2008
Question by:whiwex
  • 3
  • 3
LVL 41

Expert Comment

ID: 39528825
Yes, you can share the aspnetdb. Your membership/roles/profiles settings in your web.config should be same for WebsiteA and WebsiteB.

Author Comment

ID: 39528987
This is what I have under Membership for both web sites. I don't see a profiles

                        <remove name="AspNetSqlMembershipProvider"></remove>
                        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
LVL 41

Expert Comment

ID: 39528999
If you are not using roles or profiles, that's fine.
Make sure both of your web.config has same settings for the following:
- Membership provider
- The LocalSqlServer connection string pointing to the same aspnetdb
- MachineKey (if any)
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.


Author Comment

ID: 39529176
I am using roles but the roles are the same on both web sites.
The aspnetdb file is in the app_data folder in both web sites. WebsiteA has the current user names and passwords and has the above paste membership settings. WebsiteB is new and needs to use the same usernames and passwords as websiteA.

I figure that I have to set the config file in WebsiteB to point to the aspnetdb file in websiteA.
I just don't know how to.

LVL 41

Accepted Solution

guru_sami earned 2000 total points
ID: 39529188
Ok you won't be able to share the aspnetdb directly from app_data folder.
You will have to put the attach the aspnetdb.mdf to an SqlExpress or Sql Server instance.

Check these:
- http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx
- http://www.serverintellect.com/support/sqlserver/sql-database-attach/

Author Closing Comment

ID: 39588822

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The PowerShell Core 6.0 of .NET release is just the beginning. The upcoming PowerShell Core 6.1 would have artificial intelligence and internet of things capabilities. So many things to look forward to in the upcoming release.
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…
In the video, one can understand the process of resizing images in single or bulk. Kernel Bulk Image Resizer is an easy to use tool for resizing large number of images. One can add and resize multiple images with this tool in single go. The video sh…
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question