Results 1 to 4 of 4

Thread: Use HttpWebResponse To Get Form Value

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    3

    Use HttpWebResponse To Get Form Value

    Hello,

    Is it possible to get a form value from a website with HttpWebResponse?

    This is the part of the form i would like to get:

    <input type="hidden" name="xsrf.token" value="1358947513192.f4c8aaf7af1eab614fab23a38c5ee785"/>

    The name is always the same, but the value changes every time the page is vised.
    Is it possible to get the value to a string?

    Greetings,
    Jos Vink

  2. #2
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    259

    Re: Use HttpWebResponse To Get Form Value

    It depends what you want to do with it. You can download the content of the web page with the webclient or HttpWebRequest class and parse the results for it.
    Last edited by wakawaka; Jan 23rd, 2013 at 02:24 PM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    3

    Re: Use HttpWebResponse To Get Form Value

    Tnx for your response,

    I just want the content of "Value" to a string.

    Can you give me an example how to parse the result?

    I have managed to download the content of the webpage with HttpWebRequest.

    Greetings,
    Jos Vink

  4. #4
    Hyperactive Member
    Join Date
    Jan 2010
    Posts
    259

    Re: Use HttpWebResponse To Get Form Value

    You can either use the Html Agility Pack which allows the document to be parsed and read.

    Your other option is to use Regular Expressions to parse the response for what you need. You can use @"<input(.|\n)+?>" to start off with as the pattern. I'm really bad at RegEx so maybe someone else will be more help or you can find what you need from a google search.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width