I have a website written using C# on the top of ASP.NET MVC 5 framework. I used Microsoft.Owin.Security.OpenIdConnect
project to enable OpenID authentication on my website.
When the I click on "OpenIDConnect" to login using the OpenID server, the authentication works. But when the user is redirected to the ~/
page, I get HTTP Error 400.
Bad Request - Request Too Long
HTTP Error 400. The size of the request headers is too long.
The issue seems to happens due to having too many claims. Large amount of claims cause the cookie to be large in size.
In my project I have added the following in the Web.config
<system.web>
<httpRuntime targetFramework="4.7.2" maxQueryStringLength="20000" maxRequestLength="100000000" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="100000000" maxQueryString="20000" maxUrl="20000">
</requestLimits>
<hiddenSegments>
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
Still get the ERROR HTTP 400
. How can I fix this issue?
The Build Action is set to Content
for the Web.config
file.
Is there a setting specific to the length of the cookies? How can I fix this issue?