Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-domain login in ASP.NET Website

Tags:

c#

asp.net

I have an ASP.NET Website with login page that redirects to default page in case of successful authentication. I have another ASP.NET site under another domain, where I need to place a login form, that will redirect already authenticated user to the default page of the first website. What is the best way of doing this?

Any help will be appreciated..

like image 975
GAG Avatar asked Nov 10 '22 00:11

GAG


1 Answers

What you are after is single sign on. The mechanics of the succsesful login redirect are in the web.config

see here http://msdn.microsoft.com/en-us/library/eb0zx8fc.aspx

<configuration>
<system.web>
<authentication mode="Forms" >
  <!-- The name, protection, and path attributes must match 
       exactly in each Web.config file. -->
  <forms loginUrl="login.aspx"
    name=".ASPXFORMSAUTH" 
    protection="All"  
    path="/" 
    domain="contoso.com" 
    timeout="30" />
</authentication>
<!-- Validation and decryption keys must exactly match and cannot
     be set to "AutoGenerate". The validation and decryption
     algorithms must also be the same. -->
<machineKey
  validationKey="[your key here]" 
  decryptionKey="[your key here]" 
  validation="SHA1" />

Also look here: Asp.net forms authentication and multiple domains

like image 147
Joe Johnston Avatar answered Nov 14 '22 23:11

Joe Johnston