2

I have design 2 web apps and use Forms Authetication for single sign on

Web A: contains a Login.aspx page

Web B: contains an OK.aspx page

when access Ok.aspx in Web B, it will redirect to Login.aspx in web A (it work well)

But the problem is when I log on successfully, I can't redirect to Ok.aspx in web B

FormsAuthentication.RedirectFromLoginPage(username,false);

It try to redirect to Ok.aspx in web A not web B

my <authentication> sections:

Web A:

<authentication mode="Forms">
    <forms name="appNameAuth" 
           path="/" 
           loginUrl="login.aspx" 
           protection="All" 
           timeout="30" 
           enableCrossAppRedirects="true">
    </forms>
</authentication>

Web B:

<authentication mode="Forms">
    <forms name="appNameAuth" 
           path="/" 
           loginUrl="webAdomain/login.aspx" 
           protection="All" 
           timeout="30" 
           enableCrossAppRedirects="true" >
    </forms>
</authentication>

Any suggestion?

Gabe
  • 84,912
  • 12
  • 139
  • 238
trbaphong
  • 1,583
  • 2
  • 11
  • 9
  • Could you post `` section from both applications? – Oleks Mar 21 '11 at 15:55
  • Are the web apps on the same server and running inside the same IIS application pool? (I see you have "webAdomain" in the second example is why I ask) – Raelshark Mar 21 '11 at 18:44
  • @Raelshark:you are right. I running on the same server and running inside the same IIS application pool. WebAdomain is something like 10.22.33.22:8033. loginUrl in WebB is something like https:10.22.33.44:5555/Login.aspx. Because I want unauthenticated user will be redirect to Login Page in Web A – trbaphong Mar 22 '11 at 00:46

1 Answers1

1

You can make this work by setting the machineKey values in each of your application's web.config files so that they match.

By 'match', I mean, remove the IsolateApps setting from each web.config (as this will do exactly what it says, and that's bad for what you're trying to do).

Next, you need to generate new values for the decryptionKey and validationKey (values that match the type you select...SHA1, etc), and copy them into each of your web.configs

voila! everything should work

Here's a link to a Microsoft article on the machineKey setting, for reference: http://msdn.microsoft.com/en-us/library/w8h3skw9.aspx

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
mimeauja
  • 11
  • 1