Pregunta

my problem is i have a basic form i want to submit. First of all i can use use HttpWebRequest and Response classes. I Know them :) But in this case situation is little bit different. The form i want to submit is has some unique form Token. So i need to post that token with the form elements. But i can't read and write the response. First i am reading Token and then trying to post it but most probably it is regenerarating the code when i try to post it :) so i must post the data with the Same Request i've used :) Basically the form is something like that. there is a hidden input as u can see well :)

<form action="/" method="post">
    <input name="authenticity_token" type="hidden" value="5019d19a14a46b489a7a3a372d71d804251369b9">
    <input id="user_name" name="user[name]" size="30" type="text">
    <input id="user_password" name="user[password]" size="30" type="password">
    <input id="user_password_confirmation" name="user[password_confirmation]" size="30" type="password">
    <input id="user_submit" name="commit" type="submit" value="Create Account">
</form>

Any suggestion ?? Thank u all

¿Fue útil?

Solución

i found the solution by myself if anyone needs it: in this case website change the token according to cookie so just define two HttpWebRequest. first one is for reading and another one is posting.

and make equal first requests CookieContainer to new CookieContainer(); then make equal post requests CookieContainer to read RequestContainer that's the point ...

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top