|
-
Jul 31st, 2008, 12:50 AM
#1
Thread Starter
Lively Member
Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
Hi - first time posting at this forum:wave: ,
i want to make a simple application - i tried to search the forum but nothing found...
Automatically Login to a Protected Site (Using Authentication Dialog) like routers... or protected directory (.htaccess)
Well as i am saying - i would like to connect with simple way like from address bar or making vb program (i have many wifi aps and i want to control them from a program in vb using webbrowser or winhttp)
i know that at ftp you can write at address bar of ie:
old days i think that you can use it too for http:// but - many times i tried and get nothing... :-(
So i am familiar with VB 6 / winhttp / webbrowser controls and if someone can help me with this prob i have will be cool!!!!
Thanx in advance
ps: @ moderators - i didn;t know acctually where to post this thread - i hope it will be at right section...
Last edited by MartinLiss; Aug 22nd, 2008 at 09:59 AM.
-
Jul 31st, 2008, 12:54 AM
#2
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
Welcome to the Forums.
Are you going to be using VB6 for this then? If so I can move this thread to the Classic VB and Earlier forum.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 31st, 2008, 01:06 AM
#3
Thread Starter
Lively Member
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
yes,
simple Classic VB6,
and sorry - please reply me the new link.
Thanx
-
Aug 1st, 2008, 02:38 AM
#4
Thread Starter
Lively Member
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
-
Aug 10th, 2008, 12:58 PM
#5
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
Thread Moved
You can use the Inet control and pass the login information so you can download the page. Not sure what exactly you want to do after login.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 14th, 2008, 12:41 AM
#6
Thread Starter
Lively Member
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
inet control can pass information at authentication dialog... is it possible ?
can i have an example... ?
- what i want to do?
i want for example resetting my Access Point (applying dchp for dlink 900ap - reset it fast) - every 1 hour ..
can u give me one example - please - thanks in advance.
-
Aug 22nd, 2008, 06:39 AM
#7
Thread Starter
Lively Member
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
-
Aug 22nd, 2008, 10:00 AM
#8
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
Please don't bump your threads.
-
Aug 22nd, 2008, 08:32 PM
#9
Addicted Member
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
.htaccess uses base 64 encoding.
Add two command buttons and a winsock control to a form:
Code:
Option Explicit
Dim MyIP
Dim MyPort
Dim MyUsername
Dim MyPassword
Dim MyCGI
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
Winsock1.Close
Winsock1.RemotePort = MyPort
Winsock1.RemoteHost = MyIP
Winsock1.Connect
End Sub
Private Sub Form_Load()
MyIP = "192.168.0.1"
MyPort = "82"
MyUsername = "username"
MyPassword = "password"
MyCGI = "/cgi/some.cgi?params"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub
Private Sub Winsock1_Connect()
With Winsock1
.SendData ("GET " & MyCGI & " HTTP/1.1" & vbCrLf)
.SendData ("Accept: */*" & vbCrLf)
.SendData ("Accept-Language: en-us" & vbCrLf)
.SendData ("Accept-Encoding: gzip, deflate" & vbCrLf)
.SendData ("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" & vbCrLf)
.SendData ("Host: HostNameGoesHere" & vbCrLf)
.SendData ("Connection: Keep-Alive" & vbCrLf)
.SendData ("Authorization: Basic " & Encode64(MyUsername & ":" & MyPassword) & vbCrLf)
.SendData (vbCrLf)
End With
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim GotIt As String
Winsock1.GetData GotIt
MsgBox GotIt
End Sub
Function Encode64(InputStr As String) As String
Dim State As Integer
Dim i As Integer
Dim Base64
Dim current As Integer
Dim old As Integer
Dim first_new As String
Dim second_new As String
Dim Output As String
Base64 = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", _
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", _
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", _
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", _
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/")
For i = 1 To Len(InputStr)
State = State + 1
Select Case State
Case 1
current = Asc(Mid(InputStr, i, 1))
first_new = Base64((Int(current / 4) And &H3F))
Output = Output & first_new
Case 2
current = Asc(Mid(InputStr, i, 1))
first_new = Base64((((old * 16) And &H30) Or ((Int(current / 16) And &HF))))
Output = Output & first_new
Case 3:
current = Asc(Mid(InputStr, i, 1))
first_new = Base64((((old * 4) And &H3C) Or ((Int(current / 64) And &H3))))
second_new = Base64((current And &H3F))
Output = Output & first_new & second_new
State = 0
End Select
old = current
Next
Select Case State
Case 1
first_new = Base64(((old * 16) And &H30))
Output = Output & first_new & "=="
Case 2
first_new = Base64(((old * 4) And &H3C))
Output = Output & first_new & "="
End Select
Encode64 = Output
End Function
-
Aug 27th, 2008, 12:07 PM
#10
Hyperactive Member
Re: Automatically Login to a Protected Site (Using Authentication Dialog) like routers...
this is something i think i need hmmm...
ill try this .. thanks
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
|