MVC Authentication and Antiforgery token with Durandal SPA template
问题 Some areas of my SPA need to be open to all users, and some areas require authentication. In these areas, it's the data loaded via AJAX that I want to protect. I have an authentication service (see below), which I add as a dependency in my durandal main.js . The service is called: authentication In my main.js I call authentication.handleUnauthorizedAjaxRequest(function () { app.showMessage('You are not authorized, please login') .then(function () { router.navigateTo('#/user/login'); }); });