views:

221

answers:

2

I index.html page that post data to page1.asp page1.asp transform the data and Post it to Page2.asp with this function "PostTo"

Page2.asp is suppose to: -write the data to data.txt with "WriteToFile" Problem: WriteToFile function does not write any thing in the file when call from page2 But work when call from page1

Any suggestion?

Function PostTo(Data, URL)
     Dim objXMLHTTP, xml
    ''# On Error Resume Next
       Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
       objXMLHTTP.Open "POST", URL, False
       objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
       objXMLHTTP.Send Data
      If objXMLHTTP.readyState <> 4 then
      objXMLHTTP.waitForResponse 10
      End If
      If Err.Number = 0  AND objXMLHTTP.Status = 200 then
       PostTo = objXMLHTTP.responseText     
      else
       PostTo = "Failed"
      End If  
      '' # if xhttp.Status<>200 then err.Raise vbObjectError, , "Server returned http code " & xhttp.Status    
             Set objXMLHTTP = Nothing
   End Function
A: 

Done. you should POST to an ASP in a different virtual folder. If the ASP is in the same virtual folder, the ASP stops responding (hangs). After you close the browser, that ASP and other ASPs continue to hang because the request stays queued even though you close the browser. You must restart IIS or restart the computer.

FasoService
A: 

The problem you've encountered isn't just solved by a different virtual folder but it needs to be a different application. If you had turned ASP debugging off you will find that it would have worked.

The problem is that whilst page1 is making the request to page2 the thread it is running on is blocked waiting for the response. The request to page2 will then run on another thread.

When ASP Debugging is turned on ASP will only use a single thread to respond to requests. So when the request to page2 arrives it can't find a thread to run on since the only thread available is still running page1 so the request to page2 will get queued. However page1 will never complete until page2 completes and page2 can't complete until page1 completes so that it can use the single thread available. Your application has hung and you need to reset to clear it.

In normal usage you get 25 threads per processor so this situation is much harder to arrive at. However if you have busy site with a lot of this "Self-requesting" going on its possible to arrive at this deadlock situation (or least seriously damage performance).

AnthonyWJones
good stuff. thanks
FasoService