Re: Using Httpwebrequest to Submit multipart/form-data

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Gregory A Greenman (see_at_sig.below)
Date: 10/16/04


Date: Sat, 16 Oct 2004 20:36:52 GMT

In article <HAdcd.482227$8_6.62731@attbi_s04>,
nickmalik@hotmail.nospam.com says...
> That got right down to the details, didn't it?
>
> I take it that, even though this thread is not new, you have not solved the
> problem yet.

Nope, I had an important meeting out of town I had to prepare
for, plus I wanted to make my code more presentable before I
posted it.

> You look like you are doing things fairly well. You are collecting the
> cookies and passing them back, and the formatting looks pretty good. I
> would suggest, however, that the page that fails is calling a JSP, which
> means that the server side may have a good deal of logic to PREVENT folks
> like you from pretending to be a browser.

Here's the form tag for the three pages I'm trying to access. The
problem I was having was with the second form. It looks like the
third one uses Java, so that may be a problem there.

<FORM action="http://half.ebay.com/cat/sell/pmsearch.cgi"
method="post">

<form action="/cat/sell/save_new_listing.cgi"
enctype="multipart/form-data" method=post>

<form name="pricing" method="post" action="sell.jsp" onSubmit="if
(this.submitted) return false; else { this.submitted = true;
disableSubmits(this); return true; }">

> I don't see that you have set the User Agent header. It is probably normal
> for the JSP page to be attempting to identify the browser, perhaps to send
> back a message that will render correctly every time. I've done similar
> code (a little differently, but same concept) and I've had problems when I
> didn't set the User Agent header. That's where I would start.

That seems to have solved the problem, at least for this step. I
added this line:

HWRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows
NT 5.1; SV1; .NET CLR 1.1.4322)"

and I was able to get past the problem. I did get a 404 error, so
I'm not all the way home yet, but I'm one step closer. Also, the
404 error came later than the 505 I was getting previously.

I'm about to head out the door, so I'll see if I can make any
more progress later tonight.

> If that doesn't work, there may be some software that you can install that
> will sniff your own port 80, showing you what packets are travelling. You
> can then access the pages using IE and then using your app, to see if there
> is another header, perhaps one added by some Javascript code that downloaded
> on the previous page, that you are not sending. I know that there is a tool
> for doing this that is downloadable open source using the Unix compatibility
> libraries (I used it about 18 months ago... don't remember the name but I'm
> sure I can find it, so if you can't, let me know and I will dig a little).

I found this: tcptrace http://www.tcptrace.com/. Hopefully I'll
be able to cross this next hurdle without it.

Thanks for the help,

Greg



Relevant Pages

  • Re: Using Httpwebrequest to Submit multipart/form-data
    ... > like you from pretending to be a browser. ... > for the JSP page to be attempting to identify the browser, ... > didn't set the User Agent header. ... > for doing this that is downloadable open source using the Unix compatibility ...
    (microsoft.public.dotnet.general)
  • Re: Using Httpwebrequest to Submit multipart/form-data
    ... > like you from pretending to be a browser. ... > for the JSP page to be attempting to identify the browser, ... > didn't set the User Agent header. ... > for doing this that is downloadable open source using the Unix compatibility ...
    (microsoft.public.dotnet.framework)
  • Re: to learn jQuery if already using prototype
    ... I hold that any technology decision is a question of taste. ... The user is the poor sod looking at an alarming little grey box with yellow 'warning' triangle just above their web browser's window that says "Your browser does not support AJAX" and wondering what the hell they are expected to do about it. ... Of course if there was any technical foundation then that could be pointed at quite easily, but as the navigator.userAgent string is a reflection of the HTTP User Agent header then any such direction must lead to the definition of the header in the HTTP specification, and that definition pretty much says that the User Agent header is an arbitrary sequined of zero or more characters that is not even required to be consistent from one request to the next. ... One of the things that gets proposed as a justification for libraries of this sort is that with many individuals contributing there are plenty of eyes looking at the code to be able to find these sorts of things and fix them up front. ...
    (comp.lang.javascript)
  • Re: jQuerys latest stab at competence
    ... HTTP 1.1 User Agent header places no restrictions on the content ... The value of the - navigator.userAgent - property is the same as the contents of the HTTP User Agent header sent with HTTP requests. ... but that is because UA string based browser sniffing is based upon an assumption that has no technical basis and is demonstrably invalid. ...
    (comp.lang.javascript)
  • Re: Jasper Compilation Error
    ... > It's not a JSP throwing the error, but a bean used by a JSP. ... Do you get an error in your browser or just in the logs? ... root cause, if there is one, will be another stack trace below the first one. ...
    (comp.lang.java.programmer)