Link to home
Start Free TrialLog in
Avatar of perrizo
perrizo

asked on

ISAPI Redirect Exception

Hi, I have written an ISAPI extension dll that host active scripting.  It seems to be working well, except for one thing.  When I redirect to a URL using...

pCtxt->ServerSupportFunction(HSE_REQ_SEND_URL,(LPVOID)(LPCSTR)st,NULL,NULL);

the very next time the extension handles a request and tries to fire an ActiveX event I get an unhandled exception (type unkown?).  If I do not do the redirect then the exception is never thrown. Can anyone help?  I can supply some more code if necessary.
Avatar of jkr
jkr
Flag of Germany image

'(LPVOID)(LPCSTR)st' looks a bit suspicious - of what type is 'st' and what's the prototype of the method?
Avatar of perrizo
perrizo

ASKER

st is a CString.  I have used this format in another extension that was not an Active Scripting host and it seemed to work fine.  Do you think this is a problem?
I think it looks like a candidate, but maybe not - at least there seems to be no information how long the string is...
jkr> at least there seems to be no information how long the string is...

Sure there is! The string is null-terminated!

..B ekiM
ASKER CERTIFIED SOLUTION
Avatar of mikeblas
mikeblas

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>Sure there is! The string is null-terminated!

Ooops, you're right... <blushing>

Well, the only excuse could be that I thought of it as

[in, out, string, size_is(...)]
Avatar of perrizo

ASKER

Mikeblas, You were correct... close at least.  It sent me in the correct direction.  Seems that when you call SetScriptSite VBScript.dll remembers which thread you called it from and only accepts messages from that thread.  Funny thing was that when you do a redirect IIS always issues the next call on a different thread but, most of the time on a simple WriteClient IIS tends to issue the next call on the same thread.  The problem/feature is outlined in KB article...

http://support.microsoft.com/support/kb/articles/q222/8/37.asp

Just thought you might find it interesting... thanks!
Great!  Good luck with your project.

..B ekiM