We have an MVC 5 based web application.
Tree is displayed in the left part of the screen and is several levels deep. Each level represents different object type. When user clicks on the tree node an AJAX call is made and extended object details are received as a Partial View and displayed on the right part of the screen using jQuery call like this:
Same logic is used to edit/create delete tree nodes.
All of that works as designed, no problems here. Until user logon session expires. When this happens after user selects another tree node application sends back a view for login screen and it is being displayed as a tree element details which is confusing for the end users.
I implemented a quick and easy fix for this where I have a hidden element on login page and before calling
$('#EventTreeElement').html(data); I first check if
data contains the text for that hidden element. If so I show a dialog that logon session has expired and redirect user to logon page.
However, as most of "quick and easy" fixes this seems more of kludge than a real solution. For example I need to implement the same business logic again in all cases when user clicked "Edit", "Delete" or "Create" buttons for tree elements.
What are "proper" architectural solutions for this?