[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 750
  • Last Modified:

inet with company proxy

I re propose my old open question:
 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I'm developing a special browser (that you can look on www.realmeteo.com) that automatically download sat meteo picture and slide-show it.
With modem 56k or adsl is all ok.
I have some problems with my company http proxy.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
My request:
1) Write a little vb program that using INET download this file: http://85.214.49.20/wz/pics/D2u.jpg
2) Test it with modem and/or adsl connection
3) Now try with an http proxy
4) Send me complete project to test
 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
appendix:
my company proxy setup used with internet explorer to navigate are:
http proxy =  proxy.mycompany.it
port = 8080
usename = mayusername
password = mypassword
  / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
note: sockscap already tested dont' work !
 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
please: avoid short help comment, so I'm a novice vb programmer
° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
0
www_infrarossi_it
Asked:
www_infrarossi_it
  • 16
  • 8
  • 7
  • +1
1 Solution
 
pradapkumarCommented:
it is not the place to get the entire completed project. THis is the place to get suggestions only regarding to your doubts.
0
 
www_infrarossi_itAuthor Commented:
ok pradapkumar .... i need only to receive detailed help about question, with part of code in message.... obviously...

I rewrite question:
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
My request:
1) Write a little vb program that using INET download this file: http://85.214.49.20/wz/pics/D2u.jpg
2) Test it with modem and/or adsl connection
3) Now try with an http proxy
4) Send me complete help to repeat your test.
 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Regards
0
 
pradapkumarCommented:
I tested this solution in my office which is controlled by proxy server and a firewall.

The environment is Windows XP SP2, Visual Studio 6(VB6).

The controls used one Form, Microsoft Internet Control.

the code is :

Private Sub Form_Load()
    WebBrowser1.Navigate2 "http://85.214.49.20/wz/pics/D2u.jpg"
End Sub


It works fine. Please test it and give me feedback.

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
www_infrarossi_itAuthor Commented:
Sorry, but I have to download file, using INET control (point 1 of question) , not browse it.
Regards
0
 
pradapkumarCommented:
Option Explicit
Private strFiles(1) As String, intCount As Integer
Private blnSuccess As Boolean, blnError As Boolean
Private Sub Command1_Click()
    intCount = 0
    Do
        blnSuccess = False
        blnError = False
        Call Inet1.Execute(strFiles(intCount), "GET")
        Do Until blnSuccess = True
            If blnError = True Then
                Call MsgBox("Error!")
                Exit Do
            End If
            DoEvents
        Loop
        intCount = intCount + 1
    Loop Until intCount = UBound(strFiles)
    MsgBox "Files DOwnloaded"
End Sub
Private Sub Form_Load()
    strFiles(0) = "http://85.214.49.20/wz/pics/D2u.jpg"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
    Dim intFF As Integer, strFile As String, bytBuffer() As Byte
    Select Case State
        Case StateConstants.icError
            blnError = True
            Exit Sub
        Case StateConstants.icResponseCompleted
            strFile = "c:\TEMP\" & Mid(strFiles(intCount), InStrRev(strFiles(intCount), "/") + 1)
            If Dir(strFile, vbNormal) <> vbNullString Then Call Kill(strFile)
            intFF = FreeFile
            Open strFile For Binary As intFF
                Do
                    bytBuffer = Inet1.GetChunk(1024, icByteArray)
                    Put #intFF, , bytBuffer
                Loop Until UBound(bytBuffer) = -1
            Close intFF
            blnSuccess = True
    End Select
End Sub


Please try this
use appropriate controls as you wish.
with regards
PRadap
0
 
www_infrarossi_itAuthor Commented:
Hi,
I try your source code.
At inet1 control I add my internet explorer 8that work on proxy) properties that are:
 - proxy = proxy.mycompany.it
 - prort = 8080
 - username = myusername
 - password = mypassword
 - protocol try from 1 to 5
 - remote port 443 ?????? is correct?

this is the file generated (d2u.jpg renamed to .htm)




ERROR
Cache Access Denied

--------------------------------------------------------------------------------

While trying to retrieve the URL: http://85.214.49.20/wz/pics/D2u.jpg 

The following error was encountered:

Cache Access Denied.

Sorry, you are not currently allowed to request:

    http://85.214.49.20/wz/pics/D2u.jpgfrom this cache until you have authenticated yourself.

You need to use Netscape version 2.0 or greater, or Microsoft Internet Explorer 3.0, or an HTTP/1.1 compliant browser for this to work. Please contact the cache administrator if you have difficulties authenticating yourself or change your default password.
-----------------------------------------------------------------------
more ideas?
0
 
www_infrarossi_itAuthor Commented:
correction:
- proxy = proxy.mycompany.it
 - port = 8080
 - username = myusername
 - password = mypassword
 - protocol try from 1 to 5

0
 
jomacincCommented:
Try this using Inet control, works fine for me:


    Dim iFnum As Integer
    Dim bytPage() As Byte

    With INet
        .Protocol = icHTTP
        .Proxy = "proxy.mycompany.it"
        .UserName = "username"
        .Password = "password"
    End With

    bytPage() = INet.OpenURL("http://85.214.49.20/wz/pics/D2u.jpg", icByteArray)

    iFnum = FreeFile
    Open "C:\D2u.jpg" For Binary Access Write As #iFnum
    Put #iFnum, , bytPage()
    Close #iFnum
0
 
pradapkumarCommented:
In which manner you used your proxy settings?

You used your browser's default settings which will works fine for your normal browsing or you used the settings like "jomacinc" 's suggestion?

I used the default settings of my browser.

The settings in my browser are as :

Proxy server : 192.168.1.1
Port : 8080

that's all.
0
 
www_infrarossi_itAuthor Commented:
- jomacinc code hase same result.
- changing proxy.mycompany.it to 10.172.0.4 has the same result

How can I debug the differences form internet explorer and vb project to view differences?
0
 
jomacincCommented:
Try this by replacing "username", "password" & "proxy.mycompany.it" with correct ones, note that the port number is appended to the proxy address, this is what made it work for me:


    Dim iFnum As Integer
    Dim bytPage() As Byte

    With INet
        .Protocol = icHTTP
        .AccessType = icNamedProxy
        .Proxy = "proxy.mycompany.it:8080"
        .UserName = "username"
        .Password = "password"
    End With

    bytPage() = INet.OpenURL("http://85.214.49.20/wz/pics/D2u.jpg", icByteArray)

    iFnum = FreeFile
    Open "C:\D2u.jpg" For Binary Access Write As #iFnum
    Put #iFnum, , bytPage()
    Close #iFnum
0
 
www_infrarossi_itAuthor Commented:
The result:

<P>
While trying to retrieve the URL:
<A HREF="http://85.214.49.20/wz/pics/D2u.jpg">http://85.214.49.20/wz/pics/D2u.jpg</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Cache Access Denied.
</STRONG>
</UL>
</P>

<P>Sorry, you are not currently allowed to request:
<PRE>    http://85.214.49.20/wz/pics/D2u.jpg</PRE>
from this cache until you have authenticated yourself.
</P>
0
 
www_infrarossi_itAuthor Commented:
what about parameter .remotehost ?
0
 
jomacincCommented:
This error is being returned by your proxy server, sounds like an authentication/logon error - you should check with your system administrator and have a look at the proxy log files to find the problem.

The control appears to be doing the right thing, but your proxy is not accepting that connection.
0
 
www_infrarossi_itAuthor Commented:

NEWS!!!!

I have add
Inet1.AccessType = icNamedProxy


    With Inet1
        .Protocol = icHTTP
        .Proxy = "proxy.dea.it:8080"
        .UserName = "myname"
        .Password = "mypass"
        .RequestTimeout = 1000
        .AccessType = icNamedProxy
        .URL = "85.214.49.20/wz/pics/D2u.jpg"
    End With

answer is changed to:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /wz/pics/D2u.jpg was not found on this server.<P>
</BODY></HTML>

i.e. continue to work
0
 
jomacincCommented:
That is what I said to do in previous post...

change URL to: "http://85.214.49.20/wz/pics/D2u.jpg"

And you should be fine...
0
 
www_infrarossi_itAuthor Commented:
Dont' run
0
 
www_infrarossi_itAuthor Commented:
what about parameter .remotehost ?
0
 
www_infrarossi_itAuthor Commented:
Question is stalled.

I have download ETHEREAL program to trace ip packets in case of IE and in case of VB inet, but is mode complicated to setup and filter only wanted packet.  :-(
More info about?
0
 
jomacincCommented:
Not sure why you need to go this far to find the problem....

This error message:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /wz/pics/D2u.jpg was not found on this server.<P>
</BODY></HTML>

Shows that the control has succesfully authenticated with the proxy and that the proxy has requested the file, but the server is responding that file is not there.

I am having no trouble getting the image back, may be worth checking your DNS.
0
 
pradapkumarCommented:
one Question I have with me now,
Are u able to reach to the above file thru Browser?
If so, you will be able to receive thru your inet control also.
Then just use my program snippet without any extra information for proxy settings. It will automatically derive the settings from internet explorer.
0
 
www_infrarossi_itAuthor Commented:
pradapkumar:
one Question I have with me now,
Are u able to reach to the above file thru Browser? YES
If so, you will be able to receive thru your inet control also.
Then just use my program snippet without any extra information for proxy settings. It will automatically derive the settings from internet explorer.

THIS IS THE RESULT
-----------------------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: Cache Access Denied</TITLE>
<STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD>
<BODY>
<H1>ERROR</H1>
<H2>Cache Access Denied</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A HREF="http://85.214.49.20/wz/pics/D2u.jpg">http://85.214.49.20/wz/pics/D2u.jpg</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Cache Access Denied.
</STRONG>
</UL>
</P>

<P>Sorry, you are not currently allowed to request:
<PRE>    http://85.214.49.20/wz/pics/D2u.jpg</PRE>
from this cache until you have authenticated yourself.
</P>

<P>
You need to use Netscape version 2.0 or greater, or Microsoft Internet
Explorer 3.0, or an HTTP/1.1 compliant browser for this to work.  Please
contact the <A HREF="mailto:dea-supporto@staff.inrete.it">cache administrator</a> if you have
difficulties authenticating yourself or
<A HREF="http://internet-control-http-accelerator/cgi-bin/chpasswd.cgi">change</a> your default password.
</P>

<BR clear="all">
<HR noshade size="1px">
<ADDRESS>
Generated Mon, 24 Jul 2006 07:31:25 GMT by internet-control-http-accelerator (squid/2.5.STABLE1)
</ADDRESS>
</BODY></HTML>
0
 
pradapkumarCommented:
My Development environment for the above solution is

internet explorer 6.0
windows xp & sp2
company proxy and the only available port is 8080

pls give ur dev env
0
 
www_infrarossi_itAuthor Commented:
My environment is the same. !!!
:(
0
 
pradapkumarCommented:
I am unable to troubleshoot apart from this. I resign
0
 
www_infrarossi_itAuthor Commented:
MODERATOR GROUP, PLEASE CLOSE THIS QUESTION, SO NOBODY CAN RESOLVE IT. PROGRAM DON'T RUN
0
 
jomacincCommented:
As one last ditch, try with the resolved address instead of the IP:

    With Inet1
        .Protocol = icHTTP
        .Proxy = "proxy.dea.it:8080"
        .UserName = "myname"
        .Password = "mypass"
        .RequestTimeout = 1000
        .AccessType = icNamedProxy
        .URL = "http://wetterzentrale.de/wz/pics/D2u.jpg"
    End With
0
 
antares2001Commented:
I try, but,,,,

<H2>Cache Access Denied</H2>
<HR noshade size="1px">
<P>
While trying to retrieve the URL:
<A HREF="http://85.214.49.20/wz/pics/D2u.jpg">http://85.214.49.20/wz/pics/D2u.jpg</A>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Cache Access Denied.
</STRONG>
</UL>
</P>

<P>Sorry, you are not currently allowed to request:
<PRE>    http://85.214.49.20/wz/pics/D2u.jpg</PRE>
from this cache until you have authenticated yourself.
</P>


Sorry
:(
0
 
antares2001Commented:
I have the same problem on my company proxy!!!!!
0
 
antares2001Commented:
I think that the solution my be the correct analisy of data packet by way of ethereal.... but is more complicated also for me.
0
 
www_infrarossi_itAuthor Commented:
Yes, this is an insoluted problem.
I cant ask at system administrator so his job is try to blok all net trafic not IE.
Somebody can help me to use ethereal program to filter only internet explorer packets and inet packets, so I can try to emulate IE with INET?
0
 
jomacincCommented:
I think a fair amount of this question was answered and a good effort put in by all.
The question related to using INET with a company proxy & this was answered & shown to work.

I think the issue that is stopping the program from working is sepperate, it relates to a firewall rule, not the proxy. If www_infrarossi_it is unable to have the security altered to allow INET through the firewall then the correct answer may simply be "I can't be done".

I am not too fussed if you want to close the question with refund - Just my 2c.
0
 
www_infrarossi_itAuthor Commented:
I have a problem.
I ask for this problem.
Nobody resolve me the problem.

My question is non generally for culture... is to resolve a problem.


Best regards
0
 
jomacincCommented:
I think my post:

    With Inet1
        .Protocol = icHTTP
        .Proxy = "proxy.dea.it:8080"
        .UserName = "myname"
        .Password = "mypass"
        .RequestTimeout = 1000
        .AccessType = icNamedProxy
        .URL = "http://wetterzentrale.de/wz/pics/D2u.jpg"
    End With

Correctly answers the questions 1, 2 & 3 (4 is not usually the practice but the code is pasted).
There maybe should have been a question/note 5 saying that a firewall blocks all traffic from everything by IE.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 16
  • 8
  • 7
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now