I'm essentially trying to do what a lot of users seem to want when
using the above classes, and that's POST to a webpage.
Well, I'm golden when it comes to POSTing, I've been able to post to
websites using both the webrequest/response and webclient methods.
However, the problem I'm running into with both options is I seem to
"lose" my connection/session.
Let me try to explain a little better. I connect to a website which
has a form with an action that contains a "session id." (for example
form action="example/forum.cfm?CFID=2983DA3") This basically means I
can't hardcode the POST url, I have to load the page and sift through
the HTML for the URL i need to post to.
So essentially, my browsing of this particular webpage relies on a
session id. And if this session expires, any request I make to that
particular session redirects me to the home page and not the intended
page.
Now that I have this session id, I post using any of the two methods
above and things work great. I then repeat this process, posting to
another URL using the same session id.
But! This only works every now and then. It'll always post and give
me the correct page the first two times, however, the phantom behavior
happens on the third try.
Sometimes the post will go through, other times it'll take me to the
home page. And I can't recreate the behavior. It works, then when it
doesn't work I'll wait a little bit later and it'll work again, only
to stop working.
Any ideas on what might be the problem? Could I somehow not be
creating/closing requests/responses correctly, so I have too many
connections to the site?
I thought about this, but it doesn't seem to be the case. I used
netstat to see my connections and each time I ran the program it would
not leave any connections to the website.
Because of this thought, I tried using the WebClient since I don't
have to worry about closing responses, but it still produces the same
strange behavior.
Lost,
-Alfred