Solved

Send HTML back to the user before ISAPI exits

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 112
Folder Comparison 12 55
fix34  challenge 9 164
wordappend challenge 8 222
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

756 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