?
Solved

Send HTML back to the user before ISAPI exits

Posted on 1999-01-15
2
Medium Priority
?
192 Views
Last Modified: 2013-11-20
Hi,

I’m programming an ISAPI Dll using Ms VC++ 5.0
After requesting the function “housekeep “ of this dll, the dll will start cleaning databases and tmp files.
Because this housekeep can take up to 10 minutes I only want to report housekeep is started ( by html).
Because the html queue is only flushed if the thread ( function call ) is ended the user needs to wait 10 minutes before he receives this message. How can I directly send the html message and continue the housekeep ( complete housekeep report will be sended afterward by email ). I have tried to override the httpextensionproc but that seems no solution. Maybe someone can help with source code or suggestions to direct send html back to the client instead of waiting the thread exits …

Thanks in advanced,
Ron Daemen

0
Comment
Question by:Daemen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 1327753
Well, i'm not familiar with ISAPI programming, but the situation is well known to me...
So, why don't you simply start a worker thread in 'housekeep' that does the actual work and return from the function immediately?
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 100 total points
ID: 1327754
I'll assume you're using MFC, since you've asked this in the MFC area. (You didn't specify...)

You can send a response back immediately by calling CHttpServerContext::WriteClient(). That makes you responsible for writing all the headers, as well.

You can do whatever work you want to. Spawning an extra thread as jkr suggests is the core of the solution, but it's not quite so simple in ISAPI because you have a very special operating environment. First, you'll wnat to be able to recover the therad if it hangs.  Secodn, you'll need to make sure the newly created thread gets the appropriate security context. You'll want to call GetSecurityToken() on the thread you got from IIS, and then call ImpersonateloggedInUser() with the token you get back to make the secondary thread act like the right security context.

Of course, you'll call RevertToSelf() when it's all done.

B ekiM




0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question