Forms Authentication ReturnUrl and subdomain for single sign-on

三世轮回 提交于 2019-12-03 02:07:30

I solved this by setting a querystring in my forms element from my subdomain:

<authentication mode="Forms">
    <forms name=".ASPNET" loginUrl="http://abc.com/login.aspx?returnsite=sub" protection="All" timeout="1440" path="/" domain="abc.com" enableCrossAppRedirects="true" />
</authentication>

Then in my auth code in my main website, I check for that querystring. If it exists I build the redirect url by appending my subdomain to the returnurl.

That returnsite querystring is really only acting as a flag that I need to redirect to a known subdomain else it will work with just the redirecturl to the current domain. This should (in theory) prevent cross site scripting.

You can work around this problem by passing an authentication ticket in a query string parameter rather than in a cookie. This may help you

UPDATE
Now look at this link http://www.developer-corner.com/development/dotnet/single-sign-on-across-multiple-asp-net-applications/


UPDATE
You can also use FormsAuthentication.GetRedirectUrl method

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!