Solved

To fetch XML from different URLs when proxy server is on....

Posted on 2003-11-20
11
456 Views
Last Modified: 2008-02-01
I am working on a VB application which retrieves the XML from different URLs. I used VB Inet control for the same. But the application fails if the proxy server is on. The proxy has basic authentication. How do I send the username and password of the proxy server to this control? I also tried using ServerXMLHTTP object to achieve the same. But in this the session cookies are not maintained and my application fails.(XMLHTTP object maintains session cookies but not serverxmlhttp,  but xmlhttp cant be used to set proxycredentials). Any ideas in this regard??
0
Comment
Question by:RashmiRao1
  • 4
  • 4
11 Comments
 
LVL 9

Expert Comment

by:Dang123
ID: 9797318
Check what you have AccessType property of the inet control set to. icUseDefault (0) should use the same method as IE to connect (Proxy or direct).
0
 

Author Comment

by:RashmiRao1
ID: 9808192
Even though I set accessrype to icUseDefault(0), how do I pass the username and password of the proxy server into this control?
0
 
LVL 9

Expert Comment

by:Dang123
ID: 9810395
I am using the inet control to download HTML pages through a our proxy server, it does basic authentication also. I only needed to set the AccessType to icUseDefault for the control to deal with it. I beleave it pulls its information from the Internet Explorer setup information.

Perhaps this may help you.

HOWTO: Use the Proxy Property in the Internet Transfer Control
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/KB/ARTICLES/Q171/3/79.asp&NoWebContent=1


0
 

Author Comment

by:RashmiRao1
ID: 9815662
I am supposed to develop an application which is not dependent on IE settings. Something like Yahoo messenger,where in  option is provided for giving the username and password of the proxy server. I still didn't get how to send the username and password of the proxy server to the control.
I hope I have explained myself clearly.

0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 9

Expert Comment

by:Dang123
ID: 9817632
According to the book Visual Basic 6 Unleashed, Professional Reference Edition

"Using the Internet Transfer Control with a Proxy Server  
 
 
 If you're accessing the Internet via a proxy server, there are some special considerations you need to be aware of before using the Internet Transfer Control. You must set the control's Proxy and AccessType properties when using a proxy server.  
 
 
 First, set the Proxy property to the name of the proxy server. If you're unsure of the name of the proxy server for your system (or if your system uses a proxy server), open the Windows 9x/NT Control Panel and double-click the Internet icon. Then select the Connection tab on the Internet Properties dialog box. If the Connect Through a Proxy Server box is checked, you are accessing the Internet through a proxy server. To determine the name of the proxy server, click the Settings button. You will then see a list of the proxy servers used for different protocols such as HTTP and FTP.  
 
 
 After you have established the proxy server name and have set the Proxy property, change the AccessType property to icNamedProxy. That's all there is to it. You can now access the Internet via the Internet Transfer Control and the proxy server.  "


0
 
LVL 9

Expert Comment

by:Dang123
ID: 9817673
Based on that, I played with some code, and found I also needed to specify the proxy servers port in the address like this -


Private Sub Form_Load()
    Dim strProxyAddress
    Dim ProxyPortNumber
    Dim strPageText As String
   
    strProxyAddress = "XXXX.XXX.XX.XXX"
    ProxyPortNumber = "123"
   
    Inet1.Proxy = strProxyAddress & ":" & ProxyPortNumber
    Inet1.AccessType = icNamedProxy
   
    strPageText = Inet1.OpenURL("http://www.google.com")
    Do While Inet1.StillExecuting
        DoEvents
    Loop
    MsgBox strPageText
    End
End Sub



Please let me know if this works for you.

Dang123


0
 

Author Comment

by:RashmiRao1
ID: 9822658
No, the above code didn't work:-(
I am using CCProxy and my application fails to work on proxy server. I have given the IP address and port no correctly but still it fails. Probably I need to pass username and password. But how? Using ServerXmlHTTP I am able to pass username and password thru setproxycredentials(property) but session is not maintained. And my application needs session...
Any clues?????
0
 

Author Comment

by:RashmiRao1
ID: 10163310
Hi,
Since nobody has answered by question properly I request you to close this question. Also please refund my points as nobody has answered to my question properly.


Regards,
Rashmi
0
 

Accepted Solution

by:
amp072397 earned 0 total points
ID: 10618610
PAQed, with points refunded (90)

Thanks very much!
amp, ee admin, amp*at*experts-exchange.com
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

746 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

11 Experts available now in Live!

Get 1:1 Help Now