We currently are uploading a file and need to validate before saving it. If all validation passes we save the file and continue as normal. However if it fails we return a custom JSON object of error msgs to the client to correct. This works in IE 10 but not IE 8 (not sure about IE 9).
Little more info on what we are doing when validation fails – ASP MVC 4.
1. Set return HTTP Status code to 500 (Internal Svr Error)
2. To force IIS not to override our result set Response.TrySkipIisCustomErrors= true
3 . Return our JSON object (content-type of text/plain)
In IE 10 we get the object back in the xhr and it sees the status code of 500 and fires the error event. However in IE 8 we are getting the fakeXhr and it is determining success based on if it can parse the response as JSON. So of course it's successful and then calls the success event handler for the upload control. Now that it's fired the success event the upload control thinks all is well and updates UI/data to match.
So is there a way to:
1. Return JSON and a status code of 500 and have IE 8 see it as an error regardless of if it can parse the JSON?
2. In the success mark it really as an error (fire error event) and not have the UI/data update as if it was successful?
Any help would be greatly appreciated!
Patrick
Little more info on what we are doing when validation fails – ASP MVC 4.
1. Set return HTTP Status code to 500 (Internal Svr Error)
2. To force IIS not to override our result set Response.TrySkipIisCustomErrors= true
3 . Return our JSON object (content-type of text/plain)
In IE 10 we get the object back in the xhr and it sees the status code of 500 and fires the error event. However in IE 8 we are getting the fakeXhr and it is determining success based on if it can parse the response as JSON. So of course it's successful and then calls the success event handler for the upload control. Now that it's fired the success event the upload control thinks all is well and updates UI/data to match.
So is there a way to:
1. Return JSON and a status code of 500 and have IE 8 see it as an error regardless of if it can parse the JSON?
2. In the success mark it really as an error (fire error event) and not have the UI/data update as if it was successful?
Any help would be greatly appreciated!
Patrick