I have a page that contains multiple div's. Action on one div changes the content of other div. Each div loads a partial view from controller. For example- a div for "Search" and another div for "SearchResult". "Search" div contains couple of fields and a button. On click of this button a controller method is invoked asynchronously using Ajax. This controller method can either return a "Search Result" partial view or throw an exception.
On successful method execution, my Ajax callback will update the content of "SearchResult" div using the partial view data returned by the controllers method.
For all unhandled exceptions, I am using Elmah. Based on the above design, I would want Elmah to log an error and redirect to a Partial View. I have tried customerrors and it works for the View. One option is to remove the Error.aspx and set the defaultHandler to invoke another method (say MyCustomError) of controller which can return a Custom error as Partial View. How do I get the original exception details in this "MyCustomError" method or "MyCustomError" partial view ?
EDIT: For Elmah, I am using the solution by Elmah author - http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute/779961#779961