Re: Missing __VIEWSTATE
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Tue, 25 Apr 2006 08:00:39 -0400
"Marius Horak" <nobody@xxxxxx> wrote in message
news:eX6QqEEaGHA.4548@xxxxxxxxxxxxxxxxxxxx
When using axWebBrowser my logic is as follows (and it works every
time)
Step 1.
string url = "http://www.ServerName.com/API.dll/Get=103";
axWeb.Navigate(url, ref flags, ref targetFrameName, ref postData, ref
headers);
Step 2.
On NavigateComplete2 I get the input elements, set their value, get
the form element and call submit(). And I'm getting my pdf file within
axWeb.
Now how to reproduce these two steps with HttpWebRequest?
You download a page at http://www.ServerName.com/API.dll/Get=103 . You
parse the HTML looking for the <form> tag and for <input> tags inside.
You build your POST data, taking into account all the <input
type="hidden"> fields (in addition to the user name and password, of
course). You also need to extract the action= attribute from the <form>
element - this is where you send your POST request.
If this page does not change from navigation to navigation, you can skip
this step and essentially hardcode the POST data.
Second, you use HttpWebRequest to send a POST request to the URL you
extracted from action= attribute on step 1.
The first HttpWebRequest should be to
http://www.ServerName.com/API.dll/Get=103 and next somehow the same
request should accept a new address. But the Address property is read
only.
You don't need to use the same HttpWebRequest object. In fact, it
appears that you can't, that the URL of the request is fixed at the time
the object is created. You simply create a new instance of
HttpWebRequest for every request you need to send.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- Follow-Ups:
- Re: Missing __VIEWSTATE
- From: Marius Horak
- Re: Missing __VIEWSTATE
- References:
- Missing __VIEWSTATE
- From: Marius Horak
- Re: Missing __VIEWSTATE
- From: Igor Tandetnik
- Re: Missing __VIEWSTATE
- From: Marius Horak
- Re: Missing __VIEWSTATE
- From: Igor Tandetnik
- Re: Missing __VIEWSTATE
- From: Marius Horak
- Re: Missing __VIEWSTATE
- From: Igor Tandetnik
- Re: Missing __VIEWSTATE
- From: Marius Horak
- Missing __VIEWSTATE
- Prev by Date: Re: How to get scroll position from IWebBrowser2?
- Next by Date: Re: WebBrowser DocumentComplete Event
- Previous by thread: Re: Missing __VIEWSTATE
- Next by thread: Re: Missing __VIEWSTATE
- Index(es):
Relevant Pages
|