I'm trying to add Elmah logging to a webservice. The user gets authenticated to confirm that they are a valid user, but then they're never truly logged in. Because of this, when an error is thrown and recorded by ELMAH, the username is always blank. It would be helpful to be able to populate that value programmatically, yet I can't seem to find any way to do this.
My code is pretty simple:
public static void Add(Exception ex)
{
try
{
ErrorSignal.FromCurrentContext().Raise(ex);
}
catch (Exception ex2)
{
throw ex2;
}
}
I can't seem to find a way to create a custom exception where we specify the username.