I am using AJAX Unobtrusive on my .net core razor view as follows .. Inside my controller I have different if statements and in case of exceptions I want to return different