views:

44

answers:

0

hi ppl.

i'm using elmah in a asp.net mvc application and i'm trying to pass the error id from global asax to the controller action responsible for the handling of errors.

i want to show the error information if the exception is a custom exception.

but i'm stuck...

first of all i'm using the event handler in global asax like this

void ErrorLog_Logged(object sender, ErrorLoggedEventArgs args) { //here i can get the error id and default redirect url. }

if i use a page named error.aspx in the shared folder it will render the view without pass by controller action and of course no param is passed.

how can i call a controller action like the following one and pass the error id from global asax.

public ActionResult Trouble(string id) { return View("Erro"); }

if i use a different name like erro for example i get the following error.

System.InvalidOperationException The view 'Error' or its master was not found. The following locations were searched: ~/Views/Home/Error.aspx ~/Views/Home/Error.ascx ~/Views/Shared/Error.aspx ~/Views/Shared/Error.ascx

however the controller action "Trouble" is called the param id is null and the erro.aspx page is render.

i'm not understanding this behavior.

can someone explain this?