Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Microsoft.XMLHTTP Error 302 help please...

 
Logged in as: Guest
arrSession:exec spGetSession 2,7,37588
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Microsoft.XMLHTTP Error 302 help please...
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Microsoft.XMLHTTP Error 302 help please... - 9/8/2006 5:33:01 AM   
  anonfoo

 

Posts: 1
Score: 0
Joined: 9/5/2006
Status: offline
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.
 
 
 
Post #: 1
 
 RE: Microsoft.XMLHTTP Error 302 help please... - 10/18/2006 5:02:35 AM   
  TNO


Posts: 1036
Score: 10
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
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)

_____________________________

Consolidated Script Component: The Acid Test

A universe of complexity...

(in reply to anonfoo)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [General Forum] >> Other Programming/Scripting Languages >> Microsoft.XMLHTTP Error 302 help please... Page: [1]
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts