OK, found it (for .NET applications at least): HttpResponse.TrySkipIisCustomErrors<http://msdn.microsoft.com/en-us/library/system.web.httpresponse.tryskipiiscustomerrors.aspx>
More info here: IIS-7-Error-Pages-taking-over-500-Errors<http://weblog.west-wind.com/posts/2009/Apr/29/IIS-7-Error-Pages-taking-over-500-Errors> I apologize for having this conversation with myself publicly... perhaps it can help the odd .NET/Angular dev out there though! Kind Regards, James Crosswell On Thursday, 29 May 2014 12:28:44 UTC+2, James Crosswell wrote: > > Ah crap... it appears it's IIS (not angular): > > why-isnt-iis-7-returning-json-faults-works-on-my-machine<http://stackoverflow.com/questions/11037571/why-isnt-iis-7-returning-json-faults-works-on-my-machine> > > The workaround in that article isn't really satisfactory though... I'm not > turning on detailed error messages in my live environment (for obvious > security reasons). > > How then, can one trigger the error promise in angular from an IIS hosted > application without also forcing the custom (html) error pages to be > returned by the server? > > Kind Regards, > James Crosswell > > On Thursday, 29 May 2014 12:21:42 UTC+2, James Crosswell wrote: >> >> I've got an issue that is only happening in my live environment. >> >> I've got the code below in an angular controller: >> >> $scope.erpTest = function (integrationSettings) { >> $http.get(testUrl(integrationSettings)) >> .success(function (data) { >> $.pnotify({ >> title: 'Success', >> text: 'Connecting to ' + >> integrationSettings.IntegrationName + ' with these settings succeeded >> gloriously!', >> type: 'success', >> history: false, >> before_open: function (pnotify) { pnotify.css({ >> "top": "60px" }); } >> }); >> }) >> .error(function (data) { >> $.pnotify({ >> title: 'Failed to connect to ' + >> integrationSettings.IntegrationName, >> text: data, >> type: 'error', >> history: false, >> before_open: function (pnotify) { pnotify.css({ >> "top": "60px" }); } >> }); >> }); >> } >> >> Basically, it makes a call to some server side functionality that runs >> some tests. On success, it displays an "All OK" message and on error it >> should display an error message (as returned by the server). >> >> In my development environment, this works perfectly. However when I >> deploy to live, success does what it's supposed to but if there is any >> error (e.g. a 401 unauthorized), what I see is in the pnotify dialog is not >> a simple error message ("Unauthorized") but a full HTML page (the page that >> is configured for 401s on the server). >> >> So in the live environment, an HTML response (rather than a JSON on) >> appears to be returned for all errors :( >> >> I'm not even sure if this has anything to do with angular... but I was >> thinking perhaps the $http.get could be configured to force a JSON response >> rather than an html response (perhaps I could configure a header or >> something)? >> >> Any ideas? >> >> Kind Regards, >> James Crosswell >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
