1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Proxy authentication

Discussion in 'Visual Basic 6' started by whistller, Oct 7, 2011.

  1. whistller

    whistller Newbie

    Joined:
    Oct 7, 2011
    Messages:
    1
    Likes Received:
    0
    Hi,

    I have created web browser that surf to the internet through proxy and now I need to create a browser that surf to internet via proxy authentication server (server required enter username and password) and I dont know what command to write..
    Maybe something has a small example ?

    Pls, help
     
  2. rajan61

    rajan61 Newbie

    Joined:
    Oct 13, 2011
    Messages:
    9
    Likes Received:
    0
    :D I m using a Mitshibushi controller which is having USB feature and its belong to communication class. Actually we are developing this device so we have to configure the class in the software in the device side. We are using the driver provided by thesycon for this device :yumyum:
     
  3. captchaman

    captchaman Junior Member

    Joined:
    Sep 16, 2010
    Messages:
    190
    Likes Received:
    842
    Occupation:
    Software Programmer
    Location:
    USA
    First, this is the code for using a proxy with the webbrowser control:

    Then you need to execute your webbrowser like this
    Code:
    WebBrowser1.Navigate  URL:= "http://www.google.com" _       ,Headers:= "Authorization: Basic XXXXXX" & chr$(13) & chr$(10)
    Replace XXXXXX with a base64 encoded Username:password. Here's a base64 encoding function:
    Code:
    Public Function Base64Enc(s$) As String
    Static Enc() As Byte, Done as Boolean
    Dim b() As Byte, Out() As Byte, i&, j&, L&
    Const E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu  vwxyz0123456789+/"
    If Not Done Then Done = True: Enc = StrConv(E, vbFromUnicode)
     
    L = Len(s): b = StrConv(s, vbFromUnicode)
    ReDim Preserve b(0 To (UBound(b) \ 3) * 3 + 2)
    ReDim Preserve Out(0 To (UBound(b) \ 3) * 4 + 3)
    For i = 0 To UBound(b) - 1 Step 3
    Out(j) = Enc(b(i) \ 4): j = j + 1
    Out(j) = Enc((b(i + 1) \ 16) Or (b(i) And 3) * 16): j = j + 1
    Out(j) = Enc((b(i + 2) \ 64) Or (b(i + 1) And 15) * 4): j = j + 1
    Out(j) = Enc(b(i + 2) And 63): j = j + 1
    Next i
    For i = 1 To i - L: Out(UBound(Out) - i + 1) = 61: Next i
    Base64Enc = StrConv(Out, vbUnicode)
    End Function
    Cheers,
    captchaman
     
  4. real_coder2012

    real_coder2012 Newbie

    Joined:
    Jul 27, 2012
    Messages:
    4
    Likes Received:
    1
    at captchaman what is about this username:password ?