Previous Next

Thread: HttpModule Access to Non-ASP.NET Cookies & Headers

Last post 07-21-2008 2:57 PM by CooperNYC. 0 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (1 items)

Sort Posts:

  • 07-21-2008, 2:57 PM

    HttpModule Access to Non-ASP.NET Cookies & Headers

    I am trying to write an HttpModule to log all outbound Set-Cookie headers for any response generated by IIS7 (including un-managed handlers like ASP and PHP).  My code works fine with managed requests, but for un-managed requests the Response.Cookies collection is always empty (HttpContext.Current.Response.Cookies.Count=0). I have tried doing this at multiple points in the pipeline to no avail (currently using OnPreSendRequestContent). 

    I also have tried to get access to the cookies by directly accessing the Response.Headers collection. This works if there is only one Set-Cookie header, but for responses that set multiple cookies (and have multiple Set-Cookie headers), the only one that shows up in the Header collection is the last one (I assume this is because the collection entry is getting overwritten since all of the headers have the same name/key).

    Is there any way for me to get access to all of the outgoing Set-Cookie headers?  Ideally I would like to force the framework to populate the Cookie collection, but at a minimum if I can access all of the raw headers (including duplicate values) that would work too. Anyone have any ideas??

     

     

Page 1 of 1 (1 items)
Page view counter