473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Webbrowser and Proxy Authorization

AGP
My project uses a Webbroswer control to navigate to certain websites and do
some processing on the info found there. However, my company has a proxy
server which I must authenticate through to get to the internet. I have
tried several methods to automate the signing in to the proxy server but
cant seem to get it to work properly. My credentials look like so:

Address: proxy.mycompany.com
Port: 80
UserID: billy
Pwd: bubba

Any suggestions eiyther through Vb6 or VB.NET on how I can programatically
sign into the proxy server using the webbrowser control?

Tia
AGP

Dec 4 '07 #1
9 9324
AGP,

Your webbrowser is nothing more then the in your OS included webbrowser,
therefore you need to pass the proxy the same as you need for IE. Probably
the proxy does not see it as your webbrowser but just as IE.

Cor

"AGP" <si**********@softhome.netschreef in bericht
news:2K******************@newssvr27.news.prodigy.n et...
My project uses a Webbroswer control to navigate to certain websites and
do some processing on the info found there. However, my company has a
proxy server which I must authenticate through to get to the internet. I
have tried several methods to automate the signing in to the proxy server
but cant seem to get it to work properly. My credentials look like so:

Address: proxy.mycompany.com
Port: 80
UserID: billy
Pwd: bubba

Any suggestions eiyther through Vb6 or VB.NET on how I can programatically
sign into the proxy server using the webbrowser control?

Tia
AGP
Dec 4 '07 #2
AGP
cool i understand the part of it being a clone of my IE browser but there
has to be a way of automating the logon to the proxy server. Currenly it
presents me with a sign-in box and I just want to automate that part so I
can skip a step in my processing.

AGP

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:09**********************************@microsof t.com...
AGP,

Your webbrowser is nothing more then the in your OS included webbrowser,
therefore you need to pass the proxy the same as you need for IE. Probably
the proxy does not see it as your webbrowser but just as IE.

Cor

"AGP" <si**********@softhome.netschreef in bericht
news:2K******************@newssvr27.news.prodigy.n et...
>My project uses a Webbroswer control to navigate to certain websites and
do some processing on the info found there. However, my company has a
proxy server which I must authenticate through to get to the internet. I
have tried several methods to automate the signing in to the proxy server
but cant seem to get it to work properly. My credentials look like so:

Address: proxy.mycompany.com
Port: 80
UserID: billy
Pwd: bubba

Any suggestions eiyther through Vb6 or VB.NET on how I can
programatically sign into the proxy server using the webbrowser control?

Tia
AGP

Dec 5 '07 #3
AGP

Then it is almost for sure a registry part. Probably it is easier to set
that by hand, while in a commercial application you are in my idea walking
on the edge by putting something for that in your program.

Cor

Dec 5 '07 #4
AGP
I dont belive it has to do anything with the regsitry. all you are doing is
passing the info to the browser but I just cant seem to make it work. also
its not a commerical application, its for my personal work process.
Something like this
http://support.microsoft.com/kb/q172998/
Although that doesnt handle a proxy address and port.

AGP

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:69**********************************@microsof t.com...
AGP

Then it is almost for sure a registry part. Probably it is easier to set
that by hand, while in a commercial application you are in my idea walking
on the edge by putting something for that in your program.

Cor

Dec 6 '07 #5

"AGP" <si**********@softhome.netschrieb im Newsbeitrag
news:Ie******************@newssvr21.news.prodigy.n et...
I dont belive it has to do anything with the regsitry. all you are doing
is
passing the info to the browser but I just cant seem to make it work. also
its not a commerical application, its for my personal work process.
Something like this
http://support.microsoft.com/kb/q172998/
Although that doesnt handle a proxy address and port.
The Link basically shows, what is needed.
If you have a ProxyIP, a ProxyPort and a Proxy-Usr+Pass
then the socket-connect of the request has to be made
on the ProxyIP and ProxyPort.
Additionally your http-Header has to be enhanced by
the following.
At the very first line of the http-Header:
(not sure, if you can manage/manipulate that inside the
navigate-method of the IE-Control)
Instead of the normal first line wich would be e.g.:
"Get /" & WebUrl & " HTTP/1.1"
you will have to send to the proxy the fully qualified Url
(including the domainname/IP of the "real WebHost"):
"Get http://" & DomainOrIP & "/" & WebUrl & " HTTP/1.1"
so that the proxy gets a chance, to parse the real target-
IP out, to wich to connect to (indirectly).

Additionally your http-header has to be enhanced by
this line:
"Authorization: Basic " & _
Base64Enc(ProxyUsr & ":" & ProxyPasswd)

Now your connect should go through.
At least this works for us, if we use the socketapi
directly.

Olaf

P.S. Here's some code for Base64Encoding:

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
Dec 7 '07 #6
AGP
Thank you for the info. I can pass a header to the web control but I cannot
manilpulate the first line of the command sent to the browser. at least i
dont think i can. i have tried sending the header just like in the sample
with my base64 encodong and nothing has worked.

AGP

"Schmidt" <ss*@online.dewrote in message
news:ui***************@TK2MSFTNGP02.phx.gbl...
>
"AGP" <si**********@softhome.netschrieb im Newsbeitrag
news:Ie******************@newssvr21.news.prodigy.n et...
>I dont belive it has to do anything with the regsitry. all you are doing
is
>passing the info to the browser but I just cant seem to make it work.
also
its not a commerical application, its for my personal work process.
Something like this
http://support.microsoft.com/kb/q172998/
Although that doesnt handle a proxy address and port.

The Link basically shows, what is needed.
If you have a ProxyIP, a ProxyPort and a Proxy-Usr+Pass
then the socket-connect of the request has to be made
on the ProxyIP and ProxyPort.
Additionally your http-Header has to be enhanced by
the following.
At the very first line of the http-Header:
(not sure, if you can manage/manipulate that inside the
navigate-method of the IE-Control)
Instead of the normal first line wich would be e.g.:
"Get /" & WebUrl & " HTTP/1.1"
you will have to send to the proxy the fully qualified Url
(including the domainname/IP of the "real WebHost"):
"Get http://" & DomainOrIP & "/" & WebUrl & " HTTP/1.1"
so that the proxy gets a chance, to parse the real target-
IP out, to wich to connect to (indirectly).

Additionally your http-header has to be enhanced by
this line:
"Authorization: Basic " & _
Base64Enc(ProxyUsr & ":" & ProxyPasswd)

Now your connect should go through.
At least this works for us, if we use the socketapi
directly.

Olaf

P.S. Here's some code for Base64Encoding:

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


Dec 8 '07 #7

"AGP" <si**********@softhome.netschrieb im Newsbeitrag
news:mG*******************@newssvr12.news.prodigy. net...
Thank you for the info. I can pass a header to the web control but I
cannot
manilpulate the first line of the command sent to the browser. at least i
dont think i can. i have tried sending the header just like in the sample
with my base64 encodong and nothing has worked.
Then you should just get the Bytes of the WebPages you are
interested in over Winsock.Ocx or pure socket-api.
If you need a DOM for parsing things out you could load
the Bytes (respective the String) into the IE-Control
after you got them over the "raw sockets", writing the
http-headers the way you need it (with your proxy in mind).

Olaf
Dec 8 '07 #8
AGP
Our group needs to see the page in a browser for manual checking and other
functions. So i have to stick with the webbrowser control.

AGP

"Schmidt" <ss*@online.dewrote in message
news:eS*************@TK2MSFTNGP06.phx.gbl...
>
"AGP" <si**********@softhome.netschrieb im Newsbeitrag
news:mG*******************@newssvr12.news.prodigy. net...
>Thank you for the info. I can pass a header to the web control but I
cannot
>manilpulate the first line of the command sent to the browser. at least i
dont think i can. i have tried sending the header just like in the sample
with my base64 encodong and nothing has worked.

Then you should just get the Bytes of the WebPages you are
interested in over Winsock.Ocx or pure socket-api.
If you need a DOM for parsing things out you could load
the Bytes (respective the String) into the IE-Control
after you got them over the "raw sockets", writing the
http-headers the way you need it (with your proxy in mind).

Olaf


Dec 8 '07 #9

"AGP" <si**********@softhome.netschrieb im Newsbeitrag
news:LX*****************@nlpi070.nbdc.sbc.com...
Our group needs to see the page in a browser for manual
checking and other functions.
So i have to stick with the webbrowser control.
Sure, no problem with that.
I only say - don't navigate over the proxy directly with
the Browser-Control - just do it in two steps.
First load the Page over winsockets into a string -
then load this string (with its HTML-Content) into
the Control in a second step.

Olaf
Dec 8 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark Ferguson | last post by:
I've been trying to get a simple pycurl script working with an authenticating proxy, here is the code (with changes to protect the guilty!): from pycurl import * import StringIO b =...
1
by: Ray Slakinski | last post by:
Hello, I have defined a function to set an opener for urllib2, this opener defines any proxy and http authentication that is required. If the proxy has authencation itself and requests an...
4
by: Dave Langley | last post by:
I'm using VC++ to write an VC++ unmanaged client to communicate to a C#.NET web service. I have the proxy class for the unmanaged client and it uses the default CSoapSocketClientT<> template as...
2
by: Miguel | last post by:
Hi, I'm developing an application in C# with Windows Forms for my company that is similar to the MSN Messenger. This application uses a webservice for registering users, etc... and as 2...
3
by: George Vasiliou | last post by:
Hi to all, I have made up a small client / server application with WinSock (port 443) at VB6. I have install server in my Home, and client is running behind a proxy server. Client cannot...
7
by: chandru1782 | last post by:
Dear friends, I am trying to use CPAN for installing some perl modules. i am using a ubuntu system, which has internet connection through lan and authenticated proxy. when trying to install...
0
by: pac1250 | last post by:
Hi, I am searching how to solve a problem and I dont find it :( I want to access a page from a script behind a proxy : (my script) <-(a proxy with authentification) <-(https serveur with...
0
by: scottietrek | last post by:
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....
0
by: scottietrek | last post by:
I have a webbrowser control that allows me to save username and password infromation for a proxy server and i have been successful in changing the system default proxy for my application. What i now...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.