Firefox does not preserve custom headers during Ajax request redirect: an ASP.NET MVC solution -


I use ajaxform with jj, and there is a problem with firefox - for some reasons this x -requested - Custom header (used to detect IsAjaxRequest () ). Returns IsAjasxRequest () after redirection.

This bug is only in Firefox, for example it works fine in Chrome.

You can see the mention of this bug. A very old post, I wonder why it still happens to me (I use Firefox 3.5.3) Anyway, here's my solution - in my Base Controller class:

  Protected Override Zero Onset Exposing (Action Expating Contact Filter Contrax) {var ajaxRequestBeforeRedirect = TempData ["__ isajaxrequest"] in the form of a string; If requested (ajaxRequestBeforeRedirect! = Null) Header. Add ("Ex-Requested", ajaxRequestBeforeRedirect); } Private Bull IRDADRR Results (Action Result Results) {Return Results Gate type () Name. TOOLAV () This includes ("redire"); } Protected Override Zero On-Off Acne (Actioned Contact Filter Filter) {base.OnActionAxecuted (filterContext); If (IRDERCIRCilt (filtercontact.Reject) and request.header ["X-requested-with"]! = Null) tempadata ["__execrequest"] = request Header ["x-requested-with"]; }  

This works; However, I have two questions here:

  1. Is this bug really fixed in Firefox or I do not understand anything?
  2. Is this a good solution? Is there any better? I believe nobody had this problem before before.

Update: For those who are interested in this issue, request. Header. Add IIS6 (or maybe IIS5, but anyway). So this template data / HTTPContacts correctly. The "isAjaxRequest" flag must be stored in the item / base controller.

Just another person is questioning why their header-based dispatching is unsuccessful in Firefox , It is not certain that it has been tested in Firefox 3.6.10, as is not fixed in 2010-10-11

related bugs, and today's latest comments (by Jonas, 2010 Created on -09-16) This problem will be fixed in not in Firefox 4.

In addition to this, this bug is standard settings headers like Acceptable, which means a Accept: Application / Jason will disappear after a Redirect and your XHR engine may Instead, you will get an HTML response.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -