August 2016 Entries

Angular re-route to login page on user session expiration when user redirects to another route

Goal: Whenever the user redirects to another route via the Angular route provider, check the server if the user is still logged in by creating an MVC controller/action to verify the user session. If the user's session has expired, redirect the user to the login page. Environment: - .Net MVC Core 1.0 - Angular SPA Solution: Create an MVC controller (HomeController) to verify if the user's session has expired. In this scenario, we decided to check the .Net authentication cookie we create as part of ......

Angular - redirect to login after user session expires (including ajax/background processes)

Environment: .Net MVC with Angular v 1Issue: When the user redirects in Angular app or performs any kind of ajax request (searching inside a search box, clicking any button, etc. any event that triggers an Angular $http request to the backend), the user is not aware that they have been logged off from the server. They may redirect to another Angular "page" and search for info and get "weird" server errors.Goal: Provide the user an alert and redirect to the login page. Note, this also needs to support ......