1

I want to create a new website. The website has 3 applications, each one has its own membership/profile provider.
I want the user to be able to log in to the site with one single sign on.
Possible option AFAIK:

  • Define the same machinekeys/Connection Strings for all applications in their web.config files and I think I'm all set.

Does this work? And I'm curious to see if there's any other way.

Kamyar
  • 18,639
  • 9
  • 97
  • 171

1 Answers1

2

Yeah, that is the path to go. Just make sure the config settings are identical and all three apps will work together just fine.

As a side: you say you want to build a new website with 3 applications. Are those "apps" separate sites or virtual directories of the top site? In other words, will they share the same URL?

The only issue I can think of is if the URL's are different then the session id's will also be different and therefore force the user to log in to each of them on access. This might be okay in your situation. With your method the credentials will be the same though.

NotMe
  • 87,343
  • 27
  • 171
  • 245
  • @ Chris: They're virtual directories (Applications in IIS 7). And could you please be more clear about "work together just fine"? How can they interfere each other? – Kamyar Nov 23 '10 at 17:29
  • One important thing: should I create a user for each application programmaticaly when a user registers in one application? or is it handled automatically when I use the same machine key? – Kamyar Nov 23 '10 at 17:31
  • 1
    @Kamyar: If your keys don't match, then one site would not be able to properly encrypt the passwords for validation. Because you said you were making sure all of that was sync'd, then it will be just fine. – NotMe Nov 23 '10 at 17:31
  • @Kamyar: If they are sharing the membership provider settings, then all you should have to worry about is assigning the users to app specific roles. – NotMe Nov 23 '10 at 17:34
  • @Chris: The problem is: each application needs to connect to its own membership provider in db. (e.g. YafMembership for YAF and BEMembership for BlogEngine) They cannot have the same table for membership as far as I know. Do you suggest anything about this situation? – Kamyar Nov 23 '10 at 17:39
  • 1
    @Kamyar: unless it is a requirement that those tables be separate, they certainly can share the same membership tables. The membership system has a table called aspnet_Applications which defines all of the applications that have access to the membership data. Roles are tied to particular applications, so even if the roles have the same name they can live in the same membership database. – NotMe Nov 23 '10 at 17:42
  • 1
    @Kamyar: if it is a requirement that they be separate, then you don't have a single sign on process. Instead you'll have to write some code to manually keep all of the user accounts in sync. – NotMe Nov 23 '10 at 17:43
  • @Chris: Thank you! I'm starting to have a very clearer view about memberships in different applications. – Kamyar Nov 23 '10 at 17:45