Microsoft.XMLHTTP Error 302 help please...

Author Message
anonfoo

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 9/5/2006
  • Status: offline
Microsoft.XMLHTTP Error 302 help please... Friday, September 08, 2006 6:33 AM (permalink)
0
Hello,
 
I'm trying to write a script that uses xmlhttp to post a file to a form and once submitted the form uploads the file entered in the textbox. The page requires HTTPS and a login and password. I can login find and do a get and it returns the html of the page. The problem is when I submit the file I get an error from response.text saying an error has occured during the file upload. When I look at the web server logs it sees the file im trying to upload but returns an error 302. i think the error 302 is complaining about frames on the page and ie doesnt know how to handle it. If anyone has any ideas it would be a great help. I posted my code and error 302 below:
 
sub send_to_sdx(file_to_send)
 Dim objSrvHTTP
 Dim strHTML, sHttpArray, strDateHold, strDate, pos1, pos2
 Const adTypeBinary = 1
 Const adSaveCreateOverWrite = 2
 Const adSaveCreateNotExist = 1
 set http = CreateObject("Microsoft.XMLHTTP")
 err.clear
 http.open "GET","https://sdx.mydomain.com/tmp/",  FALSE, "username", "password"
 http.send
 
 if Err.number = 0 and http.status = 200 then
        strHTML = http.responseText
   set xml = CreateObject("Microsoft.XMLHTTP")
      xml.Open "POST","https://sdx.mydomain.com/tmp/", FALSE, "username", "password"
      xml.setRequestHeader "Content-Type", "text/xml"
      xml.Send "upload_file="&file_to_send
      
 wscript.echo Err.number
 wscript.echo xml.status
 wscript.echo xml.statustext
 wscript.echo xml.responseText
  end if
end sub
 
 
output
 
0
200
OK
<html>
<head><title>Data Exchange Service</title></head>
<body background=images/bkgrd_pg.gif>
<table border=0 width=100%>
<tr align=left>
<td><pre>        </pre></td>
<td>
<img src=images/logo.gif>
<h2 align=center>Data Exchange Service</h2>
<p align=center>Access by unauthorized users is prohibited.</p>
<br clear=all>
<h3>File Upload Error</h3>
An error has occurred during the file upload:<p>
<p><a href=index.cgi>Return to file transfer area</a>
</td></tr>
</table>
</body>
</html>
 
 
Web Server Log Error
[prd:etus:web:sdx:sdx2m3] grep username access
10.9.153.35 - - [05/Sep/2006:13:36:13 -0700] "GET /tmp?upload_file=C:\Documents%20and%20Settings\username\Desktop\filename060905.txt HTTP/1.1" 302 0
[prd:etus:web:sdx:sdx2m3]


 
Error 302
 
Looks like "302" is redirect error based on Google search.
 

CAUSE
loadTOCNode(1, 'cause');

Internet Explorer does not properly handle an HTTP/1.1 302 redirect returned from a proxy server or Internet server when the HTTP/1.1 302 redirect is sent to Internet Explorer in two separate TCP frames (one with the HTTP/1.1 302 redirect, and the other with a HTML body containing a page for the new location).

When Internet Explorer receives the first TCP frame with an HTTP/1.1 302 redirect, Internet Explorer processes the redirect command and attempts to use the open socket connection to the server that sent the redirect. This occurs because Internet Explorer has not processed the second TCP frame containing the FIN or the "socket close connection" command, so Internet Explorer assumes that the current state of the socket connection is still open. This is an intermittent problem because Internet Explorer may recognize that the socket connection was closed by the server and open a new socket connection to the server if Internet Explorer receives the TCP frames close enough together, or if no HTML body is sent at all.

NOTE: With a network packet analyzer, the server returns a standard HTTP "302 - Object Moved" header back to the browser, which is normal behavior for the redirect process. The browser should handle this and go to the redirected site.
 
 
#1
    TNO

    • Total Posts : 2094
    • Scores: 36
    • Reward points : 0
    • Joined: 12/18/2004
    • Location: Earth
    • Status: offline
    RE: Microsoft.XMLHTTP Error 302 help please... Wednesday, October 18, 2006 6:02 AM (permalink)
    0
    hmm....

    302 is not an error code, it just indicates redirecting. This may be a self-referencing URL, which could be causing the 302 message. I'm also curious to wether this HTTPS site uses session only cookies (which may be a good possibility). I had an issue in the past working with https sites. I assume that if you load the URL through the browser manually and go through the steps it won't throw an error? The only thing I came up with when I was working a similar issue was to automate the IE browser itself (which is undesireable in its own right)
    To iterate is human, to recurse divine. -- L. Peter Deutsch
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9