Solved

Send HTML back to the user before ISAPI exits

Posted on 1999-01-15
2
190 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 50 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

717 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