Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/335.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
C# Azure AD错误请求_C#_Azure_Single Sign On_Azure Active Directory_Azure Authentication - Fatal编程技术网

C# Azure AD错误请求

C# Azure AD错误请求,c#,azure,single-sign-on,azure-active-directory,azure-authentication,C#,Azure,Single Sign On,Azure Active Directory,Azure Authentication,我正在使用作为我的登录页面 但是,在某些情况下,当我从仪表板单击我的应用程序时, 当页面重定向时,我的会话已过期。我必须关闭并再次单击它,这是我在页面中获取会话的时间 第二种情况是我总是得到一个“错误的请求-请求太长错误”。 我错过了什么配置 以下是我使用的代码: public class Logon { [Authorize] public void Authenticate() { if (ClaimsPrincipal.Current.Identit

我正在使用作为我的登录页面

但是,在某些情况下,当我从仪表板单击我的应用程序时, 当页面重定向时,我的会话已过期。我必须关闭并再次单击它,这是我在页面中获取会话的时间

第二种情况是我总是得到一个“错误的请求-请求太长错误”。 我错过了什么配置

以下是我使用的代码:

public class Logon
{
    [Authorize]
    public void Authenticate()
    {
        if (ClaimsPrincipal.Current.Identity.IsAuthenticated)
        {
            string userfirstname = ClaimsPrincipal.Current.FindFirst(ClaimTypes.GivenName).Value;
            string userlastname = ClaimsPrincipal.Current.FindFirst(ClaimTypes.Surname).Value;  

            // do some checking 
            // set session and redirect 
            // when page is redirected to Home Index, session checking occur

            Response.Redirect("~/Home/Index");
        }
    }
}
至于Azure设置

我的主页URL和回复URL设置为:托管在我的本地IIS上

我通过Azure广告面板中的应用程序注册菜单添加了我的应用程序


多谢各位

您是否使用一组特定的凭据登录?如果用户是太多Azure广告组的一部分,则可能会发生此问题。您可以删除您所属的用户组的数量,也可以增加服务器上MaxFieldLength和MaxRequestBytes注册表项的设置,以便用户的请求标头不超过这些值

请看这里:


另请参见:

当您的应用程序和Azure广告进入重定向循环时,通常会发生请求过长的情况。Cookie中充满了nonce。尝试将回复URL设置为具有
[AllowAnonymous]
的操作,并将其重定向到您想要的位置。多年前,在经典MVC中,这为我解决了这个问题。