I have a .NET 4 WebAPI app that's using the ASP.NET SqlMembershipProvider.
When it works, it works fine - but if there's any problems connecting to the membership database, I just get a silent failure and the browser shows an HTTP 500 server error.
I'm using log4net to log application warnings and errors, but I cannot work out how - or where - to catch exceptions raised by the SqlMembershipProvider so they can be logged. Using Application_Error or explicitly attaching a handler to the application's Error event doesn't seem to work. Any ideas?