I got a fairly simple WinJS Metro app which gets asks the user for a username and password before getting some JSON-data from a webservice.
I use jQuery.ajax() to get the data, and i set the basic authentication header correctly. However, if the user enters incorrect credentials, and the server returns a 401, the metro runtime displays a login screen. The error handler passed to the jQuery.ajax() function isn’t called unless the user presses “cancel” on the runtime provided login screen.
I want the program to handle failed login attempts, is there a way to suppress the runtime logon screen?
Not sure what you’re doing, but the following code properly triggers the error handler if the user provides the wrong username/password:
Are you providing the username/password on your own, or waiting for the system’s login dialog to come up? I’m afraid once it comes up, there’s no getting back to your code until the user cancels, like you say.