Solved

inet with company proxy

Posted on 2006-07-13
36
718 Views
Last Modified: 2013-12-25
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
Comment
Question by:www_infrarossi_it
  • 16
  • 8
  • 7
  • +1
36 Comments
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17106199
it is not the place to get the entire completed project. THis is the place to get suggestions only regarding to your doubts.
0
 

Author Comment

by:www_infrarossi_it
ID: 17107162
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
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17107419
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
 

Author Comment

by:www_infrarossi_it
ID: 17108440
Sorry, but I have to download file, using INET control (point 1 of question) , not browse it.
Regards
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17119708
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
 

Author Comment

by:www_infrarossi_it
ID: 17120374
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
 

Author Comment

by:www_infrarossi_it
ID: 17120389
correction:
- proxy = proxy.mycompany.it
 - port = 8080
 - username = myusername
 - password = mypassword
 - protocol try from 1 to 5

0
 
LVL 4

Expert Comment

by:jomacinc
ID: 17120947
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
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17121259
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
 

Author Comment

by:www_infrarossi_it
ID: 17121886
- 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
 
LVL 4

Expert Comment

by:jomacinc
ID: 17127550
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
 

Author Comment

by:www_infrarossi_it
ID: 17128069
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
 

Author Comment

by:www_infrarossi_it
ID: 17128088
what about parameter .remotehost ?
0
 
LVL 4

Expert Comment

by:jomacinc
ID: 17128133
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
 

Author Comment

by:www_infrarossi_it
ID: 17128138

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
 
LVL 4

Expert Comment

by:jomacinc
ID: 17128755
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
 

Author Comment

by:www_infrarossi_it
ID: 17137316
Dont' run
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:www_infrarossi_it
ID: 17137347
what about parameter .remotehost ?
0
 

Author Comment

by:www_infrarossi_it
ID: 17151956
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
 
LVL 4

Expert Comment

by:jomacinc
ID: 17151998
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
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17152306
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
 

Author Comment

by:www_infrarossi_it
ID: 17165914
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
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17166958
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
 

Author Comment

by:www_infrarossi_it
ID: 17168342
My environment is the same. !!!
:(
0
 
LVL 9

Expert Comment

by:pradapkumar
ID: 17176228
I am unable to troubleshoot apart from this. I resign
0
 

Author Comment

by:www_infrarossi_it
ID: 17191325
MODERATOR GROUP, PLEASE CLOSE THIS QUESTION, SO NOBODY CAN RESOLVE IT. PROGRAM DON'T RUN
0
 
LVL 4

Accepted Solution

by:
jomacinc earned 500 total points
ID: 17191953
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
 
LVL 1

Expert Comment

by:antares2001
ID: 17193344
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
 
LVL 1

Expert Comment

by:antares2001
ID: 17193351
I have the same problem on my company proxy!!!!!
0
 
LVL 1

Expert Comment

by:antares2001
ID: 17193367
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
 

Author Comment

by:www_infrarossi_it
ID: 17214032
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
 
LVL 4

Expert Comment

by:jomacinc
ID: 17260280
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
 

Author Comment

by:www_infrarossi_it
ID: 17274591
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
 
LVL 4

Expert Comment

by:jomacinc
ID: 17291621
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now