Foro de elhacker.net

Programación => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: 70N1 en 24 Noviembre 2008, 16:53 pm



Título: COMO ACTUALIZO EL PROXY DEL AXWEBBROWSER?
Publicado por: 70N1 en 24 Noviembre 2008, 16:53 pm
Buenas.
La cuestion es que quiero que el axwebbrowser navegue a una pagina con un proxy y luego poder cambiar el proxy y que busque en otra pagina...

Le cambio bien el proxy atraves del registro de windows, pero el axwebbrowser acepta el primer proxy y luego no ahi forma de actualizarlo. el refresh no ase que actualice al proxy del explorador de windows.
Alguna idea?

vb2005.net


Título: Re: COMO ACTUALIZO EL PROXY DEL AXWEBBROWSER?
Publicado por: 70N1 en 18 Diciembre 2008, 16:52 pm
Este codigo lo que haces es refrescar la configuracion de internet explorer.(SOLUCIONADO):
Código:
 <Runtime.InteropServices.DllImport("wininet.dll", SetLastError:=True)> _
   Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean
    End Function

    Public Structure Struct_INTERNET_PROXY_INFO
        Public dwAccessType As Integer
        Public proxy As IntPtr
        Public proxyBypass As IntPtr
    End Structure

    Sub RefreshIESettings(ByVal strProxy As String)
        Const INTERNET_OPTION_PROXY As Integer = 38
        Const INTERNET_OPEN_TYPE_PROXY As Integer = 3

        Dim struct_IPI As Struct_INTERNET_PROXY_INFO

        ' Filling in structure
        struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY
        struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy)
        struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local")

        ' Allocating memory
        Dim intptrStruct As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI))

        ' Converting structure to IntPtr
        Marshal.StructureToPtr(struct_IPI, intptrStruct, True)

        Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
    End Sub