1

This issue is only happening with the current version of Safari on Mac. (Older versions of Safari may be affected, but are not needed for this)

A generic 500 error is getting returned every time for Safari only.

There is a problem with the resource you are looking for, and it cannot be displayed.

All other browser I can test with return successfully having data be the expected chunk of HTML to display.

Here is my ajax call.

    $.ajax({
        async: true,  //Added based on internet suggestions
        type: "POST",
        url: '../Provider/SaveAddress',
        data: buildAddressJsonData(),
        contentType: 'application/json; charset=utf-8',
        success: function (data) {               
            $("#result").html(data);
        },
        error: function (xhr, ajaxOptions, thrownError) {
            DisplayErrorMessage(xhr, ajaxOptions, thrownError);
        }
    });

I added in async: true based on some others saying that fixed the problem. I even tried modifying the response serverside with HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin","*"); as that was also suggested.

I've also confirmed that buildAddressJsonData() is providing proper json, here is an example.

{"IsRequired":"1","AddressIndex":"1","AddressLine1":"IBM","AddressLine2":"123 Upper St","AddressLine3":"Unit 14","City":"My Town","Id":"481c40d3-4a38-492b-880e-33b16021fb69","Lk_AddressTypeId":"d2316e7e-b2df-4274-9757-1ae5aa171f68","Lk_CountryId":"13c9fb13-8f50-438e-890a-63e6f1f4cd29","Lk_StateId":"0894fa8a-8d6b-43fc-89ec-e16ba915b6a4","SendMail":1}

This is all housed in an ASP.Net MVC5 application

None of these appear to make any change.

Edit: I'm told the server logs don't appear to show anything, but that may be by configuration (I don't have access to them)

Jason
  • 2,503
  • 3
  • 38
  • 46
  • Is there no error in the response text of the 500 error Safari is receiving? – Rory McCrossan Jan 06 '17 at 19:30
  • @RoryMcCrossan - the only response text I can see is 'There is a problem with the resource you are looking for, and it cannot be displayed.' – Jason Jan 06 '17 at 19:37
  • Very odd. The only difference I could imagine is the `data` coming from the Safari request somehow causes a problem in your server side code. Could you add the code of `buildAddressJsonData()` to the question - or at least check it is generating the object you expect it to. – Rory McCrossan Jan 06 '17 at 19:38
  • @RoryMcCrossan - the data appears to be valid JSON, I've updated the question – Jason Jan 06 '17 at 19:45
  • Indeed. There's nothing wrong with that at all. Sorry, I don't believe I can be of any more help to you – Rory McCrossan Jan 06 '17 at 19:45
  • Inspect the request and compare it with the browser that works and see what is different. Check the server logs and see what is happening. – epascarello Jan 06 '17 at 19:55

1 Answers1

0

This solution for this is what Josep suggested for this question.

It turns out that Safari on OSX and iOS blocks 3rd party cookies by default and changing this setting fixed this issue.

Community
  • 1
  • 1
Jason
  • 2,503
  • 3
  • 38
  • 46