Oto, co usiłuję zrobić w moim Global.asax.vb:Jak rejestrować nieobsłużone wyjątki w ASP.NET MVC?
Public Class MvcApplication
Inherits System.Web.HttpApplication
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute(_
"Error", _
"error.html", _
New With {.controller = "Error", _
.action = "FriendlyError"} _
)
...
'other routes go here'
...
End Sub
Sub Application_Start()
RegisterRoutes(RouteTable.Routes)
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
...
'code here logs the unhandled exception and sends an email alert'
...
Server.Transfer("http://www.example.com/error.html")
End Sub
End Class
Ale Server.Transfer zawiedzie:
Invalid path for child request 'http://www.example.com/error.html'. A virtual path is expected.
Jak mogę rozwiązać ten problem ? Albo, jaki jest lepszy sposób, aby to zrobić?
Używamy zmodyfikowanej wersji ELMAH tutaj na Stack Overflow - jest bardzo dobra. –
@Jarrod - Jakie rzeczy włączyłeś do swojego widelca? –
Reguły ELMAH - jest to bardziej przydatne niż log4net. MOIM ZDANIEM. – MikeJ