In an HttpModule, I put an Item in the Context, like this:
HttpContext.Current.Items.Add("MyKey", "Hello world!");
Directly under this code (still inside the module), I can retrieve this string from the collection, so I know it got added.
Fast forward to my actual handler (a Web form -- .aspx). I try to get this item back:
string myString = HttpContext.Current.Items["MyKey"].ToString();
Sadly, it's NULL -- the item is not there.
I spun the collection, and by the time it gets to my handler, the Items collection has two keys:
- AspSession
- AspSessionIDManagerInitializeRequestCalled
After I set the Item in the module, I call RewritePath. Not sure if that has anything to do with it.