My case is simple, I want to "map" exceptions to a HttpStatusCode. I could easily do this:

```
if (e is AuthenticationException)
{
    return HttpStatusCode.Forbidden;
}
else
{
    return HttpStatusCode.InternalServerError;
}

```

I would then add more else-if blocks checking the types.

Is there a better way of doing this? I can't use overloads, because the compile-time type of `e` is `Exception`, even though the runtime type will be something else. So this won't work (basic .NET OO):

```
private static HttpStatusCode GetHttpStatusCode(Exception e)
{
    return HttpStatusCode.InternalServerError;
}

private static HttpStatusCode GetHttpStatusCode(AuthenticationException e)
{
    return HttpStatusCode.Forbidden;
}

```

What would be an elegant way of coding this?