Skip to main content

MicrosoftAjax.js bug with Firefox

· One min read

I’m enjoying my vacation, so it’s going to be a bit quiet on the blogging front, but I did want to share a somewhat puzzling problem I had with an ASP.NET MVC application.

On a successful POST to create or update an item in a potentially long list, the application returns a Redirect to the list page with an anchor in the URL, like:

return Redirect(Url.RouteUrl(new { controller = "Controller", action = "Index" }) + "#Item" + item.Id);

This worked just as well as could be expected on every browser except Firefox (which I wasn’t actively testing the application on). On Firefox, the Controller/Index#ItemNNN page would keep reloading time and time again (probably forever).

It took me a while to identify the situation where the bug showed up (described above), but after that it was relatively easy to find the solution on Stack Overflow: the problem is due to a bug in MicrosoftAjax.js which had already been fixed ages ago (the question was from two years ago).

The solution was to replace MicrosoftAjax.js and MicrosoftAjax.debug.js with their latest versions, 4.0.30205.0 instead of 4.0.20526.0. The new files can also be loaded from the Microsoft CDN at http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js and http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.debug.js.