|
-
Jun 29th, 2009, 06:34 AM
#1
Thread Starter
Hyperactive Member
WebClient Login
Hey
Well I'm trying to log into Squidoo and simply download data from basically your own dashboard, I've written this in C sharp but I don't think it matters tbh.
vb Code:
Private Sub LoginSquidoo()
Dim wc As New WebClient()
Dim nc As New NetworkCredential("email", "password", "http://www.squidoo.com/member/login")
wc.Credentials = nc
Try
Dim response As Byte() = wc.DownloadData("http://www.squidoo.com/lensmaster/dashboard")
Dim result As String = Encoding.ASCII.GetString(response)
richTextBox1.Text = result
Catch e As Exception
MessageBox.Show("Exception", e.ToString())
End Try
End Sub
I'm getting no errors, and analysing the HTML within the result string just shows the login page, without an error or anything, it's like I just browse to the login page and did nothing. The login page looks simple enough, maybe a POST or something, but maybe the authentication scheme just doesn't work with this, advice appreciated.
Learning C♯
Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)
-
Jun 29th, 2009, 07:06 AM
#2
Re: WebClient Login
The third argument is a domain, not a web page URL. I'm not 100% sure that will fix the issue but it's a start.
-
Jun 29th, 2009, 01:24 PM
#3
Thread Starter
Hyperactive Member
Re: WebClient Login
Thanks for the tip, I tried it with the domain, but sadly nothing changed, here's the code of the login text boxes and submit button
Code:
<form method="post" action="http://www.squidoo.com/member/login" id="loginForm"
onsubmit="return validate(this);">
<fieldset>
<div class="row">
<label for="email">Your Email</label>
<input required="true" validate="email" type="text" value="" tabindex="1"
name="email_address" id="email_address" />
</div>
<br />
<div class="row">
<label for="password">Password</label>
<input required="true" type="password" value="" tabindex="2"
name="member_password" id="member_password" />
</div>
<br />
<div class="row">
<input type="checkbox" name="remember_me" id="remember_me" value="1" tabindex="3"
style="width:2em;float:left;" />
<label for="remember_me">Remember me</label>
</div>
</fieldset>
<div class="break"></div>
<div class="rowSubmit">
<input name="loginButton" type="image" src="http://cdn.squidoo.com/images/btn-login.gif"
alt="Log in" class="button" tabindex="5" />
</div>
</form>
Learning C♯
Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)
-
Jun 29th, 2009, 06:18 PM
#4
Re: WebClient Login
I've written this in C sharp but I don't think it matters tbh.
I'm more focused on this line. If you read the Forum Hierarchy level from this post, you'll clearly see that it goes:
VBForums > Visual Basic > Visual Basic .NET
And yet your code appears to be like Visual Basic .NET even though you say it was written in C Sharp. I'm sorry, but I still don't get that.
Anyway, I don't see where you are throwing any data at the form. It just looks like you're focusing on the two controls: email, and password, but you aren't throwing it any data.
But I could be wrong, since your code appears to be converted to Visual Basic .NET, because you said you wrote it in C Sharp.
-
Jun 29th, 2009, 10:26 PM
#5
Thread Starter
Hyperactive Member
Re: WebClient Login
Hi
I’m quite sure my reading comprehension is adequate, but thanks for clarifying this is the Visual Basic .Net sub forum, very helpful. Yes I’m writing a project in C #, but I already know VB syntax therefore it only took me a short amount of time to type it in VB, as language isn’t the issue, and I would get a better response from this sub forum.
Anyway back on topic, I guess I was hoping to invoke some sort of web request and it would just work heh, anyway I think using the HttpWebRequest class looks the better solution, I’ll try it out tomorrow.
Learning C♯
Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)
-
Jun 29th, 2009, 10:49 PM
#6
Re: WebClient Login
Guess what: if you're using a WebClient then you're already using an HttpWebRequest. The WebClient is simply a wrapper for common operation that use WebRequest objects. If you call WebClient.DownloadData on an HTTP URL then it will internally create an HttpWebRequest and call BeginGetResponse.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|