我正在使用https://myapps.microsoft.com/作为我的登录页面。
但是,在某些情况下,当我从仪表板上单击我的应用程序时, 页面重定向时, session 已过期。我必须关闭并再次单击它,这就是我在页面中获得 session 的时间。
第二种情况是我总是收到“错误请求 - 请求太长错误”。 我错过了什么配置?
这是我使用的代码:
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 设置为:https://mysite/logon/authenticate托管在我的本地 IIS 上。
我通过 Azure AD 面板中的应用程序注册菜单添加了我的应用程序。
谢谢。
最佳答案
您是否使用一组特定的凭据登录?如果用户属于太多 Azure AD 组,则可能会出现此问题。您可以删除您所属的用户组数量,也可以增加服务器上 MaxFieldLength 和 MaxRequestBytes 注册表项的设置,以便用户的请求 header 不会超过这些值。
关于c# - Azure AD 错误请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50616267/