Custom cookies not created in Firefox - NS_BINDING_ABORTED

50 views Asked by At

This is an ASP.NET MVC application. The cookies are not getting created in Firefox. There is no such issue in Chrome or Edge.

HttpCookie myCookie = new HttpCookie("myCookie")
{
   Value = "some_value",
   Expires = DateTime.Now.AddYears(1)
};

HttpContext.Current?.Response.Cookies.Add(myCookie);
  • I have tested this in a fresh installation of Firefox 123.0 64-bit.
  • The site is not a local site and it has https.
  • I have turned off the Enhanced Tracking Protection and also added the domain of my website in Settings > Privacy > Cookies - Manage Exceptions.

UPDATE:

I see this error in browser console for the Ajax POST call - NS_BINDING_ABORTED.

This is the JS Method:

function redirectTo(obj, url) {
   xhr('/api/MyController/SetCookie', JSON.stringify(obj), () => {
 });
 window.location.href = url;
}
1

There are 1 answers

0
sukesh On

From what I understood here, Firefox does this with any page redirection code and if there is another process running already.

So, I have added a delay and it works fine now.

function redirectTo(obj, url) {
            xhr('/api/MyController/SetCookie', JSON.stringify(obj), () => {
            });
            //window.location.href = url;            
            setTimeout(function () {                
                window.location.href = url;
            }, 500);    
        }