views:

192

answers:

0

We have the following probe query that works for a while, but it’s broken after most recent deploy onto a new set of machines.

I debugged into our ISAPI Extension code and found out that the REFERRER was not forwarded over as expected.

I checked the IIS settings, there is no difference between the machines showed problem and the production machines.

I specifically enabled in Windows Firewall the port our ISAPI Extension is hooked to, but still doesn’t work. (assume that I don’t need to reboot machine. I only did iisreset)

Any suggestions?

<%

'Global variables
Dim TryProbe(1), ProbeReferer(1) ' referer should not be null, so please include some string
TryProbe(0) = "http://localhost/?&amp;adunitid=80"
ProbeReferer(0) = "http://health.msn.com"

Dim objXMLHTTP
Dim bSuccess
bSuccess = 0 ' default failure

' Main method 

'object used to submit http call, according to MSDN the cost associated with creating this object is very less.
Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")

'Check status by submitting some test queries
for Index = 0 to UBound(TryProbe) -1   
   if( CheckDEStatus( TryProbe(Index), ProbeReferer(Index) ) = 1 ) Then
      Response.AddHeader "Proxy-Connection", "Keep-Alive"
      Response.AddHeader "Connection", "Keep-Alive"
      Response.AddHeader "Content-Type" ,"text/html"
      Response.AddHeader "Server", "Microsoft-IIS/6.0"
      Response.AddHeader "Cache-Control" ,"no-cache"
      Response.write "Success"      
      bSuccess = 1      
      exit for
   End If
Next 'for loop

if (bSuccess = 0) Then
    Response.Status ="404"
    Response.Write "Failed"
End if

set objXMLHTTP = Nothing

'Function, hits a query and checks response stream
Function CheckDEStatus(sQuery, sReferer)
  Dim strResponseText, iReturnStatus
  objXMLHTTP.Open "GET", sQuery , False
  objXMLHTTP.setRequestHeader "REFERER", sReferer
  objXMLHTTP.Send
  iReturnStatus = objXMLHTTP.Status
  strResponseText = objXMLHTTP.responseText 

  'Validate response,If the response has empty body or response status code other than 200 will be considered as failure   
  If ( (0 < InStr(1, strResponseText, "<BODY></BODY>", 1)) OR (200 <> iReturnStatus) ) Then
    CheckDEStatus = 0 'failure
  Else
    CheckDEStatus = 1 ' Success
  End If

End Function

%>