Index: Util/ThreadContextProperties.cs =================================================================== --- Util/ThreadContextProperties.cs (revision 918288) +++ Util/ThreadContextProperties.cs (working copy) @@ -146,12 +146,25 @@ /// internal PropertiesDictionary GetProperties(bool create) { - PropertiesDictionary properties = (PropertiesDictionary)System.Threading.Thread.GetData(s_threadLocalSlot); - if (properties == null && create) - { - properties = new PropertiesDictionary(); - System.Threading.Thread.SetData(s_threadLocalSlot, properties); - } + PropertiesDictionary properties = null; + if (System.Web.HttpContext.Current != null) + { + properties = (PropertiesDictionary)System.Web.HttpContext.Current.Items["log4net.Util.ThreadContextProperties"]; + if (properties == null && create) + { + properties = new PropertiesDictionary(); + System.Web.HttpContext.Current.Items.Add("log4net.Util.ThreadContextProperties", properties); + } + } + else + { + properties = (PropertiesDictionary)System.Threading.Thread.GetData(s_threadLocalSlot); + if (properties == null && create) + { + properties = new PropertiesDictionary(); + System.Threading.Thread.SetData(s_threadLocalSlot, properties); + } + } return properties; }