-1

I have a classic asp page that when running do a lengthy check repeatedly calling 20 times the same vbscript function each time with different argument. The function returns either true or false (depending on the argument). Each time the function runs it takes 5-6 seconds. So the whole time is 5*20=100 seconds. It is not an acceptable time the user to wait. I improved things a bit by using Response.Flush() after each calling to the function so the temporary results published immediately to the browser. BUT I believe that to run the function 20 times asynchronously collecting all the responses to an array is the best solution. I have found that there is a way to use asynchronous calling in server side asp like we use ajax in client side but all the examples use only one asynch calling using MSXML2.ServerXMLHTTP or Microsoft.XMLHTTP.

XMLHTTP classic asp Post

https://gist.github.com/micahw156/2968033

How do I fire an asynchronous call in asp classic and ignore the response?

1 Answers1

0

I think you need to rethink your approach to this. Instead of calling the function in server side ASP code, why not make the call from javascript? You could display all 20 lines in a table with the arguments displayed, and each row would be a separate async api call to your function. The call to the function could be a simple .asp page which takes whatever arguments are necessary to run the function and return the result.

Then your html table can be updated as the function returns.

LarryBud
  • 990
  • 9
  • 20
  • I will use this approach in combination when the page has been loaded. Then automatically it will issue 20 ajax calls in the asp page (that has the function) each with different argument – nonlinearly Dec 02 '20 at 09:53
  • 1
    That doesn't sound great, you should offload work to the server where possible but try to limit the number of concurrent requests being made. See people make this mistake when they use `.each()` with calls to AJAX multiple times and you just end up with what can equate to a DDOS attack on your web server by your own application. – user692942 Dec 02 '20 at 11:18
  • @Lankymart it is about an intranet application which is used by a maximum of 10 concurrent users. Αnd I do not see an alternative proposal – nonlinearly Dec 07 '20 at 11:15