开发者

In ASP Classic, can I have a script close the HTTP connection and continue executing?

开发者 https://www.devze.com 2023-03-26 07:42 出处:网络
I have a script that occasionally needs to do some time-consuming (15s) background processing, but other times it is a simple red开发者_如何学运维irect. The redirect target is known early on in the sc

I have a script that occasionally needs to do some time-consuming (15s) background processing, but other times it is a simple red开发者_如何学运维irect. The redirect target is known early on in the script's execution. Is it possible to, once the redirect URL is known, send the redirect HTML to the user agent and close the HTTP response, but continue processing the script?


You could solve this by executing a program (BAT, EXE, etc) asynchronously from the ASP code.

    set wshell = CreateObject("WScript.Shell") 
    runcmd = "c:\myOwnProgram.bat param1=test"
    wshell.run runcmd, 0, False 

Wshell.Run lets you run stuff async. So fire away your timeconsuming tasks without worrying about script timeouts! Really great.

0

精彩评论

暂无评论...
验证码 换一张
取 消