Re: Internet class differences...



Cor,

That reference has given me an idea... the one thing I have not done is to try to save the whole header from the first HTTPWebClient and use it in the second... I don't even know if that is possible, but the example you linked to did access the header of the HTTPWebCLient object, so... possibly this can be done!

I'll let you know (here) how it works out!

Thank you!



Cor Ligthert [MVP] wrote:
Peter,

With sending back I have no expirience. To retrieve the pages in a way that you can handle them is on this page. The same classes are in my opinion to sent the data back.

http://www.vb-tips.com/default.aspx?ID=541adf13-d9c0-435c-893f-56dbb63fdf1c

I hope this helps a little bit on the route,

Cor


"Peter Hayes" <phayes02@xxxxxxxxxxxx> schreef in bericht news:dsjVf.15327$Da7.11409@xxxxxxxxxxxxxxxxxxxxxxx

I'm afraid that I have no control over the server side and, I think, the
web service would need to be created to interface with the database server.

The database and web interface to the server is produced by a different
company (not the one for which I'm programming) and it just happens that
they and we share clients (and it would be helpful if our database app
could obtain selected information from their database app). But, this is
the interface they have provided us.

Would a MFC version of this provide more flexibility? I suspect it would
be more difficult to write (and networking is obviously not my forte -
nor is MFC, for that matter!) but might allow more control over the
network packets?

I do appreciate the reply! Thank you, Cor! If I've misunderstood how web
services might be used, please correct the ignorant! It just seems that,
given that the interface to this other database is constant and not
subject to changes on my account, I need to be able to work with that
interface someplace.


Pete

Cor Ligthert [MVP] wrote:

Peter,

Are you able to replace this by a webservice.

A webservice is very easy to make with visual Studio Net.

Cor

"Peter Hayes" <phayes02@xxxxxxxxxxxx> schreef in bericht
news:ry0Vf.15217$Da7.7134@xxxxxxxxxxxxxxxxxxxxxxx


I've tried this on another group without any resolution, so let me see if
anyone here has an answer - please! ;-)

I have a database with which I must communicate queries via a web-based
interface. The queries are not in a standard format, but involve strings
such as

...&fieldA=value1&fieldA=value2&...fieldA=valuej&fieldB=valueK...

being sent to the web interface.

This was started as a C++.NET project for some other reasons unrelated to
the networking. Initially a WebClient class was used. An object was
instantiated and the 'name-value' method of sending data was used.

This worked fine for submitting the query. The result of the query is an
HTML page returned (from the server)containing some parameters and a
javascript method that opens a new window with the results... the
parameters are sent to the new page requesting the results (via a
sessionID cookie and sequence number). So, after sending the initial
query, the reply is parsed to obtain the new page and sequence number. The
same object - the WebClient - is redirected to the page and retrieves the
query results.

This all works fine for simple queries - where fieldA has only a single
value required. However, if fieldA requires multiple values, the WebCLient
(actually the name-value collection of the WebClient) believes that
multiple values should be sent as

...&fieldA=value1,value2,value3...

which causes the query processor at the database end to choke.

I have not found any means of using the WebCLient that allows me to send
all of the selections I need for the queries without reformatting
something in the query. So, I tried the HTTPWebRequest class.

The HTTPWebRequest object does a dandy job of allowing me to format my
queries so that the database at the other end (and all the query
processing) is happy - I have tried a number of complicated ones and
always receive the 'redirect' javascript response indicating that the
query processed properly.

However, there seems to be no way to redirect the HTTPWebCLient class to a
new page, so a new object needs to be created. I use the same
cookiecollection for both the initial query request and the second results
request (two different HTTPWebCLient objects) so that the second object
obtains the sessionID cookie from the first one. However, it does not
retrieve the results but, instead, is sent to a login page from which it
is impossible to retrieve the results (the login initiates a new session,
new sessionID, therefore makes access to the results impossible).

I have used an ethernet sniffer to inspect the packets from the WebClient
(which works completely with simple queries) and the HTTPWebRequest (which
submits the query successfully but seems unable to submit the cookie and
sequence number properly to retrieve the results). The only difference I
can see in the packets is that the WebCLient orders the header values
slightly differently (the same values are present but their order is
different from the HTTPWebRequest ordering of the same values) and the
WebClient returns not just the cookie name-value combination, but also the
'Path=/' parameter from the internal cookie. The HTTPWebRequest has the
Path member set properly (to '/') but does not return this with the cookie
to the redirected server page - only the name-value members are sent.

I don't know if the order or the lack of a 'Path=/' in the header/cookie
causes the failure, but something is doing it and I can't figure out how
to change the behavior...

I'm tearing my hair out on this and looking for any help/ideas.

Thanks a lot for anything to follow up on! 8-)






.



Relevant Pages

  • Re: Internet class differences...
    ... The database and web interface to the server is produced by a different ... Initially a WebClient class was used. ... This worked fine for submitting the query. ... retrieve the results but, instead, is sent to a login page from which it ...
    (microsoft.public.dotnet.general)
  • Internet class differences...
    ... The result of the query is an HTML page returned containing some parameters and a javascript method that opens a new window with the results... ... The same object - the WebClient - is redirected to the page and retrieves the query results. ... The HTTPWebRequest object does a dandy job of allowing me to format my queries so that the database at the other end is happy - I have tried a number of complicated ones and always receive the 'redirect' javascript response indicating that the query processed properly. ... I use the same cookiecollection for both the initial query request and the second results request so that the second object obtains the sessionID cookie from the first one. ...
    (microsoft.public.dotnet.general)
  • Re: Internet class differences...
    ... Initially a WebClient class was used. ... This worked fine for submitting the query. ... The HTTPWebRequest object does a dandy job of allowing me to format my ... obtains the sessionID cookie from the first one. ...
    (microsoft.public.dotnet.general)
  • Re: Internet class differences...
    ... web service would need to be created to interface with the database server. ... Initially a WebClient class was used. ... This worked fine for submitting the query. ...
    (microsoft.public.dotnet.general)
  • RE: WebClient
    ... HttpWebRequest/HttpWebResponse object (with AutoRedirect); Apparently, ... the cookies aren't set each time a redirect command is ... is HttpWebRequest broken in this regard, where Microsoft has to fix it? ... Try using this class instead of WebClient: ...
    (microsoft.public.dotnet.general)