First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
« More Interesting Maps | Main | You must implement the Add(System.Object... »

In ASP.NET the Response object has a very useful method called AppendToLog. It was also around in the Classic ASP days. The Response object hangs off the HttpContext. If you're running with the context of an HttpRequest you can always get ahold of the current HttpContext via the static HttpContext.Current.

However, not everyone executes within managed code in ASP.NET. We've got a bunch of ISAPI code that is all C++/ATL/MFC. Within MFC you can get ahold of the context via the CHttpServerContext class. This class isn't as friendly as the whole Request/Response ASP model.

If you want to get to the really useful stuff you have to run through a 3rd Class API actually named ServerSupportFunction that's hanging off an Extension Control Block. Lame. The second parameter is a DWORD that indicates the function you're trying to call. Since we were trying to call the equivalent of Response.AppendToLog we would use HSE_APPEND_LOG_PARAMETER. The additional information you're trying to log will show up in the cs-uri-query extended field within IIS if you're using the W3C Extended Log File Format. You'll need to go into IIS Properties and enable the logging of this field.

So, doing this in managed code:

HttpContext.Current.Response.AppendToLog(strFoo);

Is this in unmanaged "classic" C++ ISAPI:

m_pCHttpServerContext->m_pECB->ServerSupportFunction( 
                                m_pCHttpServerContext->m_pECB->ConnID , 
                                HSE_APPEND_LOG_PARAMETER , 
                                szFoo, 
                                &dwFooLen , 
                                NULL 
                            );

Big ups to Paul Gomes from Corillian for figuring this out! And no I'm not off vacation yet; my wife is asleep. :)



Monday, August 29, 2005 9:42:03 AM (Pacific Standard Time, UTC-08:00)
Do you know how to get a handle to the session object from an ISAPI Filter? Even a classic ASP session object (COM) would be helpful.

-Wayne
Wayne Berry
Comments are closed.

Contact

Sponsors

Hosting By

On this page...

Tags

Calendar

<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

Archives

Google Ads