title: Execute function from start on error/timeout through Vb Script in classic asp
body: <p>I have the following method in my <code>create.asp</code> page:</p>
  
  <pre><code>Public Function read(url)
  
      Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
      Set xml = Server.CreateObject("Microsoft.XMLDOM")
  
      xmlHttp.Open "GET", url, False, PROXY_USERNAME, PROXY_PASSWORD
      xmlHttp.SetProxy 2, PROXY
      xmlHttp.SetTimeouts 0, 0, 0, 0
      xmlHttp.Send
  
  
      xml.Async = False
      xml.SetProperty "ServerHTTPRequest", True
      xml.ValidateOnParse = True
  
      xml.Load xmlHttp.ResponseXml
  
      Set read = xml
  
      Set xmlHttp = Nothing
      Set xml = Nothing
  End Function
  </code></pre>
  
  <p>The function works 9 times out of 10. </p>
  
  <p>Problem: In rare occasions, it gives me a timeout error. For this reason, I have set <code>xmlHttp.Timeouts</code> to infinity. I have also tried using <code>On error</code> statements, but that does not resolve the issue.</p>
  
  <p>Question: <strong>*<em>How do I execute the function from the start if it gives me any kind of error? *</em></strong> The only error I have come across is the timeout error when it tries to execute <code>xmlHttp.Send</code>.</p>
  
  <p>Any other possible solution would also be appreciated.</p>