Proxy With Webbrowser control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scottietrek
    New Member
    • Jul 2008
    • 4

    Proxy With Webbrowser control

    Ok i am able use a proxy with basic auth but after i navigate to the page i want to click a link but when i do i get the login information. the page behind does change but but i get the auth window. what i want to happen is not to have the auth window. I can hit cancel or ok it reall does not matter the page loaded just fine behind the login window. Is there a way to catch that window and tell it go go away. Here is the code for setting up the proxy.
    <Runtime.Intero pServices.DllIm port("wininet.d ll", SetLastError:=T rue)> _
    Private Shared Function InternetSetOpti on(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLengt h As Integer) As Boolean
    End Function

    Private Sub RefreshIESettin gs(ByVal strProxy As String)
    Const INTERNET_OPTION _PROXY As Integer = 38
    Const INTERNET_OPEN_T YPE_PROXY As Integer = 3
    Dim struct_IPI As Struct_INTERNET _PROXY_INFO
    ' Filling in structure
    struct_IPI.dwAc cessType = INTERNET_OPEN_T YPE_PROXY
    struct_IPI.prox y = System.Runtime. InteropServices .Marshal.String ToHGlobalAnsi(s trProxy)
    struct_IPI.prox yBypass = System.Runtime. InteropServices .Marshal.String ToHGlobalAnsi(" local")
    ' Allocating memory
    Dim intptrStruct As IntPtr = System.Runtime. InteropServices .Marshal.AllocC oTaskMem(System .Runtime.Intero pServices.Marsh al.SizeOf(struc t_IPI))
    ' Converting structure to IntPtr
    System.Runtime. InteropServices .Marshal.Struct ureToPtr(struct _IPI, intptrStruct, True)
    Dim iReturn As Boolean = iReturn = InternetSetOpti on(IntPtr.Zero, INTERNET_OPTION _PROXY, intptrStruct, System.Runtime. InteropServices .Marshal.SizeOf (struct_IPI))
    End Sub

    Ok its not loading the page behind the login. is there a way to add the basic auth header to the webbrowser or what has to be done here can i use a system.net.webp roxy to accomplish this but from how do you set it to the webbrowser request.
    Last edited by scottietrek; Jul 22 '08, 05:43 AM. Reason: new development
Working...