Set Proxy Credential in Web Browser Control

Posted by rockacola on Stack Overflow See other posts from Stack Overflow or by rockacola
Published on 2010-03-26T00:07:33Z Indexed on 2010/03/26 0:13 UTC
Read the original article Hit count: 932

I am working on a legacy code where an application uses AxSHDocVw.AxWebBrowser (NOT System.Windows.Forms.Control) to open up web pages and am extending it to take proxy into considerations.

I have following example on http://www.pinvoke.net/default.aspx/wininet/internetsetoption.html to use InternetSetOption() to go through specified proxy and tested that it works.

Now the hurdle is I tried everything but failed to pass username and password with following code:

//-- Set Proxy Username
bool resultF = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY_USERNAME, username, username.Length+1);
var errorF = Marshal.GetLastWin32Error();

//-- Set Proxy Password
bool resultG = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY_PASSWORD, password, password.Length+1);
var errorG = Marshal.GetLastWin32Error();

Both resultF and resultG return true and has no errors but it still working. Any hint on what may be happening here? and what method do I have to debug this?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about proxy

Related posts about credentials