We use the approach described below to log our webservice errors with Elmah. And it really works, but unfortunately the username recorded in the log is empty.
We did some debugging and found that when registering errors in ErrorHandler it HttpContext.Current.Userhas the correct user set.
We also tried:
HttpContext context = HttpContext.Current;
ErrorLog.GetDefault(context).Log(new Error(pError, context));
and
ErrorLog.GetDefault(null).Log(new Error(pError));
Without success.
Any ideas on how we can get Elmah to register a username?
In the side signal when registering an error directly with the Webservice, the user name is registered as expected. But this approach is not very harsh.