My HttpModules uses the PreRequestHandlerExecute event and seems to be losing the identity which I am impersonating when I get to the callback function. I can check the user it is running under (with Environment.UserName) and it goes from the impersonated user (in the begin function) to Network Service(in the end function).
Anyone seen something like this and can point my in the right direction for a fix?
UPDATE:
I have found that the issue is [likely] related to the asynchronous call that is made, if the call is thrown in to synchronous mode, the user is not lost. I'm guessing it has something to do with how IIS/asp.net handles completing the asynchronous call. My hypothesis is that a thread is pulled from the app pool without using the user the virtual directory is running under.