-2

has anyone come across this property? I am actually trying to implement a single sign on for 2 asp.net websites in a different domain. Looking for a sample code for this? many thanks!

user603007
  • 11,416
  • 39
  • 104
  • 168

1 Answers1

1

Have a peek at this page if you are using cross domain you'll need to make sure you use cookie-less authentication too since the cookies won't be cross domain.

Theres a nice code sample from a author of another Stack Question here.

if (FormsAuthentication.EnableCrossAppRedirects)
{
text = context.Request.QueryString[name];
if (text != null && text.Length > 1)
{
    if (!cookielessTicket && FormsAuthentication.CookieMode == HttpCookieMode.AutoDetect)
    {
        cookielessTicket = CookielessHelperClass.UseCookieless(context, true, FormsAuthentication.CookieMode);
    }
    try
    {
        formsAuthenticationTicket = FormsAuthentication.Decrypt(text);
    }
    catch
    {
        flag2 = true;
    }
    if (formsAuthenticationTicket == null)
    {
        flag2 = true;
    }
}
if (formsAuthenticationTicket == null || formsAuthenticationTicket.Expired)
{
    text = context.Request.Form[name];
    if (text != null && text.Length > 1)
    {
        if (!cookielessTicket && FormsAuthentication.CookieMode == HttpCookieMode.AutoDetect)
        {
            cookielessTicket = CookielessHelperClass.UseCookieless(context, true, FormsAuthentication.CookieMode);
        }
        try
        {
            formsAuthenticationTicket = FormsAuthentication.Decrypt(text);
        }
        catch
        {
            flag2 = true;
        }
        if (formsAuthenticationTicket == null)
        {
            flag2 = true;
        }
    }
}
}
Community
  • 1
  • 1
John Mitchell
  • 9,653
  • 9
  • 57
  • 91