A little pain, to be honest. Moreover, in my opinion, if you use Federated Identity, for example, Windows Identity Foundation and / or Azure AppFabric Access Control Service.
Your Ajax calls cannot handle redirection.
My solution / suggestion does not mean that your actions related to the Ajax call are performed using [Authorize], but instead rely on the presence of some value that you insert into the Session state from the action of the controller having [Authorize] (usually the method actions of the controller that was called to display the view). You know that the value could not get into the session state if the user was not authenticated (and the session was not completed). The call to your Ajax method failed if this value is missing, returning a specific JSON result that you can handle gracefully in your client code.
Using [Authorization] in the Ajax controller method causes strange, often hidden errors (for example, the disappearance of updates).
source share