Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can open a link in a browser no problem, but code returns 302

Status
Not open for further replies.

Don Child

Programmer
Apr 4, 2003
64
US
Hi,

A utility we wrote some time ago works with almost all of the urls we give it, but stubbornly returns a 302 for 3 of them.

The code is similar to this:

Code:
    Set objHTTP = CreateObject( "Msxml2.ServerXMLHTTP.6.0" )
    Request_s = "GET"
    objHTTP.SetTimeouts 2000, 30000, 30000, 60000
    'Asyncronous 
    objHTTP.Open Request_s, Url_s, True
    objHTTP.setOption 2, SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
    objHTTP.setRequestHeader "Connection", "keep-alive"
    objHTTP.Send
    xRet = objHTTP.WaitForResponse(30)

What approach should we take, towards these rare urls that won't return a 200? As noted in the subject, the browser has no problem opening the addresses.

Note that the urls DO redirect, as the 302 indicates. But we also tried replacing the url with the final url that the browser redirects to. So if we originally put in in the script which returned a 302, but the browser redirected to then we also tried in the script and got the same 302 result.

Should we ignore the 302 and consider it a successful connection?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top