Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在表单身份验证asp.net正常工作的情况下获得enableCrossAppRedirects?_Asp.net_C# 3.0_Single Sign On - Fatal编程技术网

如何在表单身份验证asp.net正常工作的情况下获得enableCrossAppRedirects?

如何在表单身份验证asp.net正常工作的情况下获得enableCrossAppRedirects?,asp.net,c#-3.0,single-sign-on,Asp.net,C# 3.0,Single Sign On,有人见过这片土地吗?实际上,我正在尝试为不同域中的2个asp.net网站实现单点登录。正在查找此的示例代码? 非常感谢 如果您正在使用跨域身份验证,您需要确保您也使用了无cookie身份验证,因为cookie不会跨域 有一个很好的代码示例,来自另一个作者 if (FormsAuthentication.EnableCrossAppRedirects) { text = context.Request.QueryString[name]; if (text != null && t

有人见过这片土地吗?实际上,我正在尝试为不同域中的2个asp.net网站实现单点登录。正在查找此的示例代码? 非常感谢

如果您正在使用跨域身份验证,您需要确保您也使用了无cookie身份验证,因为cookie不会跨域

有一个很好的代码示例,来自另一个作者

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;
        }
    }
}
}