Reputation: 75
This may sound really stupid but I have to ask cause I'm not finding this answer anywhere.
I have an application where the user will need to sign up for a new user account on the website "wxw.reddit.c0m/register".
However when I am using Firefox's plug-in Firebug to view html I am getting something totally different than when I just right click on the site and view the page source.
What I am trying to do is to get the captcha from the website and display it in a picturebox on the application so the user can view the captcha, solve the captcha and then the app post is back to the service for a response.
Here is the source that I am getting using Firefox's Firebug to inspect the element:
<td>
<input type="hidden" value="Oo3Jo1I8bgzK68agMqo3s79ZZib2OkbK" name="iden">
<img class="capimage" src="/captcha/Oo3Jo1I8bgzK68agMqo3s79ZZib2OkbK.png" alt="i wonder if these things even work">
</td>
Here is the actual page source from right clicking on the page.
<td>
<input name="iden" value="TwRNQVs8sFuU2B2IuESDFUdrnuVyuFc8" type="hidden"/><img class="capimage" alt="i wonder if these things even work" src="http://www.redditstatic.com/kill.png" />
</td>
Why would the two be showing me two different versions of the HTML?
And how would you be able to grab that source to view in a picturebox using webclient?
Upvotes: 0
Views: 1433
Reputation: 198324
Page Source will give you literally what the browser receives from the server.
Firebug shows you the current content of the page.
The two will differ if the page has been manipulated by JavaScript since loading.
You can get the current source of the page by running this bookmarklet (i.e. either pasting this into the URL bar, or bookmarking it into a button):
javascript:h=document.getElementsByTagName('html')[0].innerHTML;function%20disp(h){h=h.replace(/</g,'\n<');h=h.replace(/>/g,'>');document.getElementsByTagName('body')[0].innerHTML='<pre><html>'+h.replace(/(\n|\r)+/g,'\n')+'</html></pre>';}void(disp(h));
(from Captain_kurO)
This, on the literal question part of your question. Otherwise, @minitech is much more to the point: CAPTCHA exists for a reason, and you're kind of going against it. :p
Upvotes: 3
Reputation: 224922
Captchas are dynamically generated with JavaScript. Since you can't easily execute the JavaScript by just downloading it (you generally require a web browser), that's a little more safety for the captcha.
Judging by the fact that you're using a WebClient
, I'd say you're trying to register automatically. This might be for "legitimate" purposes but it can also be used for the wrong reasons. What you need to do in this case is open up the webpage using Process.Start
and let your user register themselves.
Upvotes: 1