Re: Retrieve Form Key-Values from HttpWebResponse

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

From: Joerg Jooss (joerg.jooss_at_gmx.net)
Date: 09/21/04


Date: Tue, 21 Sep 2004 16:24:46 +0200

Erik Jensen wrote:
> I have implemented HttpWebRequest and then coded HttpWebResponse
> which reads into a stream and then into a string.
>
> By using the resultant string, stream, or Response, how do I get key
> value pairs for the response form variables. Is it within
> Response.Headers["FormKey1"].ToString()?

No, HttpWebResponse itself is completely agnostic to what it contains -- it
could be anything from a HTML document to a MP3 file.

> or, do I work from the string which was the end result after my
> Stream.ReadToEnd()?

Yes, you need to search through the HTML document. Have a look at this blog
entry, it could be helpful in your case:

http://blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx

Cheers,

-- 
Joerg Jooss
joerg.jooss@gmx.net 


Relevant Pages

  • HTTPS with WebResponse class
    ... http:// connection. ... public string postForm ... HttpWebResponse result = null; ... Stream ReceiveStream = result.GetResponseStream; ...
    (microsoft.public.dotnet.security)
  • Re: HTTPS with WebResponse class
    ... Best way to test your client is see if you can do the same from IE. ... > public string postForm ... > result = (HttpWebResponse) req.GetResponse; ... > Stream ReceiveStream = result.GetResponseStream; ...
    (microsoft.public.dotnet.security)
  • RE:.NET SAP Connector / single sign on via ASP.NET
    ... string username = "BLA"; ... HttpWebResponse response = null; ... request.Method = "POST"; ... Stream receive_stream = response.GetResponseStream; ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Randomly request timeout (IIS6.0)
    ... I have got IIS 6.0 on Windows 2003 Server. ... string host_address ... HttpWebResponse response; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Post Data (Urgent)
    ... post is essentially a string delimited in a special way ... StreamWriter streamWriter = null; ... HttpWebResponse httpWebResponse = ... Unfortunaly the session variables do not exist. ...
    (microsoft.public.dotnet.framework.aspnet)