Webbrowser control and


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Webbrowser control and

  1. #1
    Join Date
    Jul 2008
    Posts
    1

    Webbrowser control and

    I have beeb trying to set up a proxy using oxy-Authorization header. i have tried passing a header to the web browser control but this is not working. i would like to set up basic Proxy-Authorization. but i would like to do this with wininet.dll. i have tried the options above but to now avail. if i pass these do i have to pass the header. also do i need to base64 the strings in the internetsetstr. there is an example of my code below.
    Code:
    Private Sub RefreshIESettings(ByVal strProxy As String)
            Const INTERNET_OPTION_PROXY As Integer = 38
            Const INTERNET_OPEN_TYPE_PROXY As Integer = 3
            Const INTERNET_OPTION_PROXY_USERNAME As Integer = 43
            Const INTERNET_OPTION_PROXY_PASSWORD As Integer = 44
            Dim struct_IPI As Struct_INTERNET_PROXY_INFO
            ' Filling in structure
            struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY
            struct_IPI.proxy = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(strProxy)
            struct_IPI.proxyBypass = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi("local")
            ' Allocating memory
            Dim intptrStruct As IntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
            ' Converting structure to IntPtr
            System.Runtime.InteropServices.Marshal.StructureToPtr(struct_IPI, intptrStruct, True)
            Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
            Dim isetu As Integer = InternetSetOptionStr(IntPtr.Zero, INTERNET_OPTION_PROXY_USERNAME, streuser, Len(streuser))
            Dim isetp As Integer = InternetSetOptionStr(IntPtr.Zero, INTERNET_OPTION_PROXY_PASSWORD, strepas, Len(strepas))
            MsgBox(isetu.ToString + isetp.ToString)
        End Sub
    the message box retrurns 00

    the function set.
    Code:
     <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 Declare Function InternetSetOptionStr Lib "wininet.dll" Alias"InternetSetOptionA" _
    (ByVal hInternet As Long, ByVal lOption As Long, ByVal sBuffer As String,ByVal lBufferLength As Long) As Integer
    the header i have tried.
    Code:
     Dim h As String
            Dim cc() As Byte
            Dim aa As String
    
            cc = System.Text.ASCIIEncoding.ASCII.GetBytes(userinfo(ProxieNum))
            aa = Convert.ToBase64String(cc)
            h = "Proxy-Authorization: Basic " + aa + "\r\n"
            Return h
    thank you in advance for any help.

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Moved to the .NET section
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Replies: 0
    Last Post: 08-11-2006, 08:42 AM
  2. WebBrowser Control Question - VB 2005
    By Shifting Sight in forum .NET
    Replies: 2
    Last Post: 08-11-2006, 03:40 AM
  3. WebBrowser control...
    By FLD in forum Enterprise
    Replies: 2
    Last Post: 11-20-2000, 12:34 PM
  4. WebBrowser control...
    By FLD in forum ASP.NET
    Replies: 0
    Last Post: 10-20-2000, 03:41 PM
  5. WebBrowser control...
    By FLD in forum Web
    Replies: 0
    Last Post: 10-20-2000, 03:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center