Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 22nd, 2004, 12:16 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can you get object context in an ISAPI Filter?

I've written an ISAPI Filter that tries to grab the Session object(ISessionObject) via the ObjectContext. There are several examples of this in regular(non-ISAPI Filter) DLLs, but non for an ISAPI filter. My code for getting the object context appears ok.

When I attached my ISAPI filter to the inetinfo process and stopped it at a breakpoint, it gave the "There is no MTS object context" error.

Am I trying the impossible? Can one not get an mts object context in an ISAPI filter?

TIA,

Andy C.

Andy C
 
Old May 24th, 2004, 11:28 AM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was trying to do something similar with an ISAPI filter and was able to get a reference to the SessionObject in the filter by passing a reference created with the OBJREF moniker back to the filter within a Header.

However the only usefull property I could get back from the object was the sessionID. I could not read any properties (i.e Session("xxx") in the filter as the object was clobbered in some way. When calling these methods durring a page request within a COM object they worked fine.

The Application object does not have this problem (I think this is due to a compatible threading model or something like that) and you can get and set values within it from inside an ISAPI filter. If you set application variables like Application("Session": & Session.ID) = "xxx" you can happily read these from within the filter.

At http://www.johnno.com/code/ you can find the work in progress which includes two projects, one being the ISAPI filter and another being the COM object which creates the object reference. If you register the COM object and install the filter onto a new demo virtual server in IIS, the demo content in the zip shows a filter protecting a directory until a variable of Application("Session: & Session.ID) is set to True.









Similar Threads
Thread Thread Starter Forum Replies Last Post
isapi url rewrite question rykiel Classic ASP Professional 0 October 9th, 2007 03:22 AM
How to use context object in PHP zerone01 PHP How-To 0 February 26th, 2007 09:45 AM
Microsoft SQL isapi extension ERROR - FIX proslambano BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 January 6th, 2007 10:25 AM
Can you get object context in an ISAPI Filter? andyc Classic ASP Professional 1 February 23rd, 2006 07:56 AM
ISAPI filters k2k Visual C++ 0 July 10th, 2004 12:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.