开发者

Cross app redirect in Forms Authentication

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜