Solved

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

Posted on 2003-11-20
11
468 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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
 
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

632 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