Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 01, 2012 05:36 PM by CPrakash82
Aug 31, 2012 05:19 AM|LINK
Is it possible to show the error details like error.Exception , and its some properties in a view (Error.cshtml)
Now i am able to send the mail to a specified id and shows a custome page Error.cshtm. How can i read the error details and show them on View instantly.
We can call a method like this on Global.cs and this will execute immediatly after error occurs. But how can we read details from here to view?
protected void ErrorLog_Logged(object sender, Elmah.ErrorLoggedEventArgs args)
Is it possible ?
Aug 31, 2012 07:29 PM|LINK
You can use HandleError attribute and mark action with HandleError, it will automatically handle all error for your action and redirect to Error.cshtml, with
HandleErrorInfo as model, you can use the exception property out of it in view and display.
Alternatively, you can handle the exception in Global.asax with Application's Error event and display the exception. You can find one example
Sep 01, 2012 10:45 AM|LINK
Both methods will work, but i am using ELMAH for error handling. So how can i show the details of error instantly on view keeping the ELMAH as it is. SInce i dont want to switch from this
Sep 01, 2012 05:36 PM|LINK
I am not about exact option, but sure that you can log the error with Elmah and display the error on the UI. Also try the customError options in the web.config file.