.
 
 
The Search Engine Optimization Experts
 

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."

 

Theres something thats been bugging me for a little while now ... a rash of unexplained redirect loops occurring in newly installed DotNetNuke sites.

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 around 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 lets 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 is a couple of options for fixing this:

1. Install the .NET framework 3.5 (this includes AJAX 3.5)
OR  2. Download and install AJAX Extensions 1.0 (this is AJAX for ASP.NET framework 2.0).  This download is available at the bottom of the page www.asp.net/ajax/downloads

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:

3a. If you installed .NET framework version 3.5:  Open your web.config and replace every Version=1.0.61025.0 with Version=3.5.0.0 - make sure to get all of them!  Then restart IIS (start - run - cmd - iisreset)
3b. 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.

If you want to prove to yourself that this is the cause of the redirect loop (dont believe everything you read on the internet!), just follow this experiment:

1.  Install a new DNN website using medium trust. Confirm that it has a redirect loop.
2.  Install Extensions 1.0 and follow method 3b above. Confirm that the redirect loop is gone.
3.  Remove Extensions 1.0 and confirm that it has a redirect loop again.
4.  Install framework 3.5 and follow method 3a above.  Confirm that the redirect loop is gone.

By the way, the source of the bug is in PageBase.vb around line 529:

            If objBasePortalException.Message.Contains("System.Web.Extensions") Then
                ' suppress AJAX error in Medium Trust
                Response.Redirect(strURL)
            Else

This code checks for an exception that contains "System.Web.Extensions" (the AJAX dll), and if found, redirects to 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!



* 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 its worth listing the solutions here.

1. Your portal alias has a trailing "/", eg www.example.com/. Simply remove the "/" to fix.
2. 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).

 

 

 

Comments

Oscar Martin said:

Comments have now been enabled, just click "Add Comment" below to start. No registration is required. The rules are simple - no html and no spam! All comments are moderated, but only spam and rubbish will be deleted. The point of this moderation is not to censor what you say, just to stop the spam.
7/19/2008

Jason said:

Sounded promising.... However the problem's still there :( What else might be causing this error? Extremely frustrating...
8/5/2008

Oscar Martin said:

The main problem described above started from around version 4.7 - what version are you using? Also did you try the two quick tips at the bottom - they describe a couple of other ways to get and fix the problem.
8/6/2008

Add CommentAdd Comment  
 

Latest Blog Post

Occasionally we come across a great DotNetNuke module that is really worth its weight in gold ...

Read more ...

 

More Blog Posts

.