Solved

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

Posted on 2003-11-20
11
459 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 54
Visual Studio 2005 text editor 10 38
Prevent user closing word document opened with VB6 6 74
fso.FolderExists("\\server\HiddenFolder$") 4 65
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

772 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