Problem Reading Webpage
Posted: Sun Oct 31, 2010 3:15 am
To start off, I really don't know if I am posting this in the correct spot, so please feel free to move it accordingly if not.
Ok, I am trying to allow users to sign into my program using a sign in form I have created, but I am having a problem detecting whether or not a user already exists. I'm basically using the coding below, but am getting errors.
Ok, I am trying to allow users to sign into my program using a sign in form I have created, but I am having a problem detecting whether or not a user already exists. I'm basically using the coding below, but am getting errors.
Code: Select all
The problem is that an error occurs because the reader cannot find the page... But the point is for it NOT to find the page. If it does find the page, then that means the user name already exists, but if it does not, the new user can be created. Anyone have any suggestions, because I'm completely out of ideas.... dunnno;
Try
If MessageBox.Show("You may only create one account. Are you sure you want to continue?", _
"New Account", _
MessageBoxButtons.OKCancel, _
MessageBoxIcon.Information) = Windows.Forms.DialogResult.OK Then
If Not TextBox2.Text = TextBox3.Text Then
MsgBox("Your passwords did not match.")
Else
V------PROBLEM STARTS HERE----V
Dim url As String = "http://mywebsite.com/" + TextBox1.Text + ".accnt"
Dim pageRequest As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
Dim pageResponse As WebResponse = pageRequest.GetResponse()
Dim page As String = ""
Using r As New StreamReader(pageResponse.GetResponseStream())
page = r.ReadToEnd()
End Using
^------PROBLEM ENDS HERE (Kinda)----^
If Not page = TextBox1.Text & vbNewLine & "Account Exists" Then
If MessageBox.Show("Do you wish to create this new account?", _
"New Account", _
MessageBoxButtons.OKCancel, _
MessageBoxIcon.Information) = Windows.Forms.DialogResult.OK Then
'Create account