ProtekNickz
Well-known member
hi, this is just a project im working on for myself, now i use to do somthing simlet to this using "VB6" with "winsock raw socket" which was really ideal to use as i liked the way you could program a whole protocol around it, now i'm not sure if the best way is to use "webclient" for this or "Socket.TCPClient" so some guidence would be apriciated, now as i suggest in my code this does not work yet!, my router does not require ssh so its a plain simple login, the bellow code i used here was somthing simler to what i did using "VB6" using the headders and sending the string like so, but from the response headder i can tell it's not logging in at all, i know this the way im doing it is correct as i've done this many times, but is their an easier way or am i sending the string format wrong or somthing?, cheers in advance for any help
.
Imports System.Net Imports efxControl.efxControl 'Control i made which does some simple efx's Public Class Login Public lConnect As New WebClient Public sHost As String = My.Computer.Registry.GetValue _ ("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\Tcpip\Parameters\Interfaces\{44B9B5B6-4AC5-4644-9DA7-DF4B4839C41B}" _ , "DhcpServer", Nothing) Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogIn.Click Dim sendData As String 'For login user and pass which im experimenting with, not working as i can tell 'lConnect.Credentials = New Net.NetworkCredential(txtName.Text, txtPass.Text) 'Accumalates data and sends to router for the required login, as of yet not working. lConnect.OpenRead("http://" + sHost) sendData = "/goform/valogin?loginUsername=" & txtName.Text & "&loginPassword=" & txtPass.Text & "&n=1 HTTP/1.0" & vbCrLf sendData += "Accept: */*" & vbCrLf sendData += "Accept: text/html" & vbCrLf & vbCrLf lConnect.UploadString(sHost, sendData) 'Displays for headder and page source TextBox1.AppendText(lConnect.ResponseHeaders.ToString) TextBox1.AppendText(lConnect.DownloadString("http://" + sHost)) 'implemented Functions for efxControl 'efxFading(90, 1, -1, Me) 'efxShrinkGrow(200, -1, Me) End Sub Private Sub Login_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.Text = "Virgin Media Super Hub " & sHost End Sub End Class