Response.Redirect results in "Object moved to here"

gkrogers picture gkrogers · Feb 2, 2010 · Viewed 68.8k times · Source

I'm working on a C# ASP.NET page that normally ends up redirecting to a "file:" URL. This seems to work fine the majority of the time, in the majority of circumstances, but occasionally (and, on my test system, apparently always) instead of a redirect to a file I get a page with the text "Object moved to here", where "here" is a link to the file that I was trying to redirect to, but with four slashes after the colon instead of two (i.e. "file:////testserver/docs/testdoc.doc")

This is normally accompanied by a "System.Threading.ThreadAbortException: Thread was being aborted" message.

I've looked for a solution elsewhere and found out some interesting stuff about Response.Redirect causing ThreadAbort exceptions, but that doesn't seem to be the fundamental problem - it seems to me that the actual problem is the "Object moved to here" message, which causes the exception to be thrown.

Anybody got any suggestions why I'm getting that...?

EDIT: Forgot to mention I'm running Firefox (3.5.7) with IE Tab, so was about to mention that when I thought I'd better try it in IE, and voila - it works in IE (7).

Answer

Dan Diplo picture Dan Diplo · Jun 19, 2012

Just for future reference another reason this can occur is if you do something like Response.Redirect(null) or similar. I had a situation where my variable holding the URL was null and this is what I got.