Okay, i now understand.<br>Should i get the &quot;302&quot; in dorf1.code? i have 200 there :(<br>Do you have any idea on the way to check that the access have been granted (or not)?<br><br><div><span class="gmail_quote">2007/7/16, Mat Schaffer &lt;
<a href="mailto:schapht@gmail.com">schapht@gmail.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""><div><span class="e" id="q_113cf672adfae7d0_1">
<div><div>On Jul 15, 2007, at 9:35 AM, hazynrg wrote:</div><br><blockquote type="cite">Hello,<br>I have a login form on /login.php which POSTs to /dorf1.php when access is granted and to /login.php when it is denied.<br><br>
require &#39;rubygems&#39;<br>require &#39;mechanize&#39;<br>agent = WWW:Mechanize.new ()<br>login = agent.get(&quot;<a href="http://server/login.php" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://server/login.php</a>&quot;)<br>form = login.forms.action(&quot;dorf1.php&quot;)<br>form.fields[2].value = &quot;wronguser&quot;&nbsp; # login<br>form.fields [3].value = &quot;wrongpass&quot;&nbsp; # password<br>dorf1 = form.submit
()<br>dorf1.uri<br>&nbsp;&nbsp;&nbsp; # =&gt; #&lt;URI::<a href="HTTP:0x15af2e04dc7c" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">HTTP:0x15af2e04dc7c</a> URL:<a href="http://server/dorf1.php" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://server/dorf1.php</a>&gt;<br><br>But the page we got was &quot; login.php&quot; (a bit altered: &quot;access denied&quot;, etc.)<br>So the URI of the page returned by form.submit() isn&#39;t updated if there is a redirect, please fix :)
<br>Best regards.</blockquote></div><br></span></div><div>Mechanize doesn&#39;t support javascript, so if you&#39;re changing target based on that, it won&#39;t work. &nbsp;If you&#39;re using a html meta tag to redirect from 
dorf1.php back to login.php on failure, I don&#39;t think that would work either. But a 302 (header(&quot;Location: login.php&quot;)) should work.</div><span class="sg"><div>-Mat</div></span></div><br>_______________________________________________
<br>Mechanize-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Mechanize-users@rubyforge.org">Mechanize-users@rubyforge.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://rubyforge.org/mailman/listinfo/mechanize-users" target="_blank">
http://rubyforge.org/mailman/listinfo/mechanize-users</a><br></blockquote></div><br>