Fixing infinite DotNetNuke redirect loops: "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
There is something that has been bugging me for a little while now ... a rash of unexplained redirect loops occurring in the newly installed DotNetNuke sites.
How to solve this problem
You know you have this problem if your site will not load in IE - it just sits there, apparently doing nothing, and when you try in Firefox, you get the error message: "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
It used to be quite easy to solve a DotNetNuke redirect loop problem - there were only two likely causes, and solutions to both are easy to find with Google. See the bottom of this post if you really want to know how to fix either of those two problems..
However, a new way to get redirect loops has recently appeared on the scene, since about version 4.7 or so. Now, many people are getting redirect loops on their DotNetNuke websites, and there is no solution to be found on Google.
There is one post that hints at half of the solution, and several posts that hint at the other half. But now, for the first time, all these hints have been brought together to solve this problem once and for all.
The first hint that leads to solving the problem can be found here on Chris Hammond's blog, where he says that the problem occurs when you use medium trust.
But, that is not the full story, because DotNetNuke can, and does, work under medium trust - so changing your web.config to use Full trust is not the answer. Instead, letss take a look at DNN under medium trust and see if there are any other recently uncovered issues - and it turns out that, there is one that has been brought up a few times since 4.7 (so it matches the timeframe of when the new redirect bug appeared). The problem I'm talking about is that AJAX does not work under medium trust (when using the default web.config settings).
So, the main candidate for this problem is Microsoft AJAX.Net, which does not work in medium trust if it is in your website /bin folder (it must be in the GAC instead). So, the key to solving this bug is getting Microsoft AJAX.Net installed and working under medium trust. There are a couple of options for fixing this:
- Install the .NET framework 3.5 (this includes AJAX 3.5), OR
Download and install AJAX Extensions 1.0 (this is AJAX for ASP.NET framework 2.0). This download is available at the bottom of this page.
After installing either of these, you will also need to change your web.config so that your website knows which version of AJAX you are using:
- (a) If you installed .NET framework version 3.5: Open your web.config and replace every
Version=220.127.116.11 - make sure to get all of them! Then, restart IIS (Start - Run - cmd - iisreset).
(b) If you installed AJAX extensions 1.0: Just restart IIS (Start - Run - cmd - iisreset).
If you are using a hosted web server, then you will need to ask your hosting support desk to fix this for you. They may already have 3.5 installed. In this case, just change the version numbers in your web.config as described above in 2 (a).
If you want to prove to yourself that this is the cause of the redirect loop (don't believe everything you read on the Internet!), just follow this experiment:
- Install a new DNN website using medium trust. Confirm that it has a redirect loop.
- Install Extensions 1.0 and follow method 2 (b) above. Confirm that the redirect loop is gone.
- Remove Extensions 1.0 and confirm that it has a redirect loop again.
- Install Framework 3.5 and follow method 2 (a) above. Confirm that the redirect loop is gone.
Other possible causes
Before this bug, what used to be the most common way to get a redirect loop, and how do you fix it? Some people may still get redirect loops caused by these issues, so it's worth listing the solutions here.
- Your portal alias has a trailing "/", e.g.: www.example.com/. Simply remove the "/" to fix the problem.
- The website is on a port number other than port 80. Simply change web.config and set
usePortNumber="true" (note there is no setting to say *which* port number to use, this is controlled by IIS).
Points of interest
By the way, the source of the bug is in PageBase.vb around line 529:
If objBasePortalException.Message.Contains("System.Web.Extensions") Then
This code checks for an exception that contains "
System.Web.Extensions" (the AJAX DLL), and if found, redirects back to the current page - which will, of course, throw the same exception, which will be caught, and the page will be redirected back to the same URL again, and ....oops!
This solution was first posted on my DotNetNuke tech blog.