I have a situation whereby I need to return an exception to the client in the form of a partial view. Here is my code
catch(PasswordException ex)
{
Response.StatusCode = 500;
ViewBag.Message = ex.Message;
return PartialView("Exception");
}
I'm setting the response statuscode to 500 so the response is caught in the error section of the ajax call.
This works fine but it seems a bit overkill to return a server error just to flag this exception.
Is there a better/standard way of doing this?