Link to home
Start Free TrialLog in
Avatar of RashmiRao1
RashmiRao1

asked on

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

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??
Avatar of Dang123
Dang123

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).
Avatar of RashmiRao1

ASKER

Even though I set accessrype to icUseDefault(0), how do I pass the username and password of the proxy server into this control?
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


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.

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.  "


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


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?????
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
ASKER CERTIFIED SOLUTION
Avatar of amp072397
amp072397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial