kbaccouche
kbaccouche

Reputation: 4605

Single Sign on in multiple ASP MVC 3 applications

I have a solution that has two applications. Is it possible to make the user sign in only once?

For example, in the main application I do authentication like this:

FormsAuthentication.SetAuthCookie(ContactFound.ContaLogin, model.RememberMe);

And I put this code in the web.config file:

<authentication mode="Forms">
  <forms 
    loginUrl="~/Account/LogIn" 
    defaultUrl="~/Account/LogOn" 
    timeout="15"
  />      
</authentication>

What should I add, so that, when the user is logged in, in the main application we don't ask him to log in again when he connect to the second application?

Upvotes: 3

Views: 4677

Answers (1)

hangy
hangy

Reputation: 10859

Since you are going to host both applications at the same address, it should be easily possible by setting the <machineKey> (web.config) to the same value for both applications. After that, you should automatically be logged in to one application after logging in to the other.

Further reading:

Upvotes: 5

Related Questions