1

Is it possible for two or more ASP.NET MVC sites to use a single SQL Server database for authentication and other things?

Here's how I'm thinking of setting it up: I will combine the current database of each site into one single database, prefixing the tables with the name of the site they belong to. I currently have authentication tables generated by the asp.net_regsql.exe utility. How should I combine those tables? I'm guessing that the way to do it is to somehow set the "application_id" column in those tables...

Thanks in advance.

1 Answer 1

1

The membership/role/profile/session providers usually have an option to include an "ApplicationName" This applicationname will be used to filter out the membership/role/profile/session queries. You can set this applicationname in the web.config like this:

<providers>
  <clear/>
  <add name="ProviderName"
     (...)
     applicationName="/"
     (...)
     >
</providers>

Change this tag (by deafult is't "/", but you can change it to any string you want) in each application and the M/R/S/P provider will take care of the rest

Sign up to request clarification or add additional context in comments.

1 Comment

So this means that my hypothetical design of combining the databases will work? Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.