I am using Global.asax to perform logging at the end of each request via the Application_EndRequest event. However, I am seeing some odd behavior of certain values stored in the HTTPContext.Current.Items collection.
Below is the debug output for a nullable Enum. You can see that there is a value, but HasValue resolved to False?!
{System.Nullable(Of AreaNameEnum)}
HasValue: False
hasValue: False
Value: {System.InvalidOperationException}
value: ADMIN {0}
I am guessing that it is too late in the request lifecycle to access the HTTPContext.Current - but it seems to sometimes work and sometimes not. Can anyone shed any more light on exactly what is going on?
Thanks