I have an ASP.NET 4.5 webforms site and trying to setup forms authentication. I have an Account folder with a Login.aspx page within. The main web.config contains the following:
<authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880"/> </authentication> <authorization> <deny users ="?" /> <allow users = "*" /> </authorization>
When I browse to the site, it appropriate redirects to Account/Login.aspx and then throws a browser error indicating
Too Many Redirects
. I am at a loss as to what could be wrong or where to go to troubleshoot next. Any assistance would be appreciated.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Please check if you have somewhere on your page that you have redirected to same page that you are in, or somewhere global, this endless loop.
eg Response.Redirect("Login.aspx");
Method 2
I have seen this before and the issue was resolved by clearing cookies and browser history.
Method 3
Check that your ASP .net State Service is running. Starting this service resolved this problem for me.
Method 4
Having an older version of the .Net Framework Runtime than is used by the application would also be the cause of this type of error.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0