473,699 Members | 2,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to specify proxy/authority for XmlDocument.Loa d()

Hi All,

I am trying to access xml-files in the internet from my intranet-page.
Making XmlDocument.Loa d() calls internally works fine, but not so to the
internet. I think the calls are failing, because we use a proxy-server.

Can I specify a specifix proxy in the call and/or in the
configuration-files? For the configuration-files, I am not finding samples,
which point out how to specify username and password. For the XmlDocument, I
even find nothing in this range, so, do I have to make a webRequest
"manually" specifying a proxy and pass the pulled data to the XmlDocument
after that?

Any help would really be very welcomed!

Best regards,
Manfred Braun

(Private)
Mannheim
Germany

mailto:_m****** *******@manfbra un.de
(Remove the anti-spam-underscore to mail me!)

Nov 11 '05 #1
2 12006
Manfred Braun wrote:
I am trying to access xml-files in the internet from my intranet-page.
Making XmlDocument.Loa d() calls internally works fine, but not so to the
internet. I think the calls are failing, because we use a proxy-server.


Read "Supplying Authentication Credentials to XmlResolver when Reading
from a File" at
http://msdn.microsoft.com/library/de...ngfromfile.asp
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
Hi Oleg,

sad to say, this lokks true. Anyway, it's not too much code, but eveythings
is too new for me .....
With help of MSDN/SDK I made the following working successfully:

//+++ excerpt
StreamReader oSR = null;
WebRequest objRequest =
WebRequest.Crea te("http://msdn.microsoft. com/rss.xml");

bool useProxy =
Boolean.Parse(S ystem.Configura tion.Configurat ionSettings.App Settings["usePro
xy"]);
if(useProxy)
{
string address, port, username, password, domain;
address =
System.Configur ation.Configura tionSettings.Ap pSettings["address"];
port = System.Configur ation.Configura tionSettings.Ap pSettings["port"];
username =
System.Configur ation.Configura tionSettings.Ap pSettings["username"];
password =
System.Configur ation.Configura tionSettings.Ap pSettings["password"];
domain =
System.Configur ation.Configura tionSettings.Ap pSettings["domain"];

WebProxy myProxy = new WebProxy(addres s, Int32.Parse(por t));
myProxy.BypassP roxyOnLocal = true;
NetworkCredenti al myCred = new NetworkCredenti al(username, password,
domain);
myProxy.Credent ials = myCred;

objRequest.Prox y = myProxy;
}

WebResponse objResponse = objRequest.GetR esponse();
oSR = new StreamReader(ob jResponse.GetRe sponseStream()) ;
oDS.ReadXml(oSR );

//--- excerpt

Anyway, thanks for your help. My sample above is from a code, where a
DataSet is used, while I use XmlDocument. But I am shure, I can adapt the
one or two lines of code to use XmlDocument!

Best regards,
Manfred
"Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
news:Ox******** ******@TK2MSFTN GP12.phx.gbl...
Manfred Braun wrote:
and thanks for your posting. After studying this document, I found, that it does'nt resolve my problem going through a proxy-server. It would apply, to specify creadentials to the destination. But in my case, the destination-url is accessibly publicly and I have to deal with our proxy....


Yeah, you are right, that's not enough.
So you have to deal directly with WebRequest class. There are two ways
I'm aware of - direct one and elegant one. Former - create WebRequest,
set up its proxy property, get WebResponse and load XmlDocument from
response's stream.
More elegant way - encapsulate above WebRequest/WebResponse logic into
custom reusable XmlResolver.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel


Nov 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6840
by: Gustaf Liljegren | last post by:
I need to merge several XML files into one large. All of them has a DOCTYPE tag, but the SYSTEM identifier points to a DTD that doesn't exist. (I use the PUBLIC identifier with catalog files, so the SYSTEM identifiers has no purpose in my application.) Anyway, when I load each document, using XmlDocument.Load(file), I get a FileNotFoundException, because of the DTD pointer in the SYSTEM identifier. I'd rather skip all the entity...
8
4427
by: Whugster | last post by:
I have this really frustrating problem when calling XmlDocument.Load(string filename). Whenever I call this method in a web application in my Windows XP development PC, I get the following error: Specified argument was out of the range of valid values. Parameter name: The specified value must be greater than 0. Here's the stack trace: -------------------------
1
3546
by: Chief | last post by:
I am unable to load an xml document that contains Chinese characters in an attribute value. I need to load the document into and XmlDocument object and am using the XmlDocument.Load(string filename) method. I get an error that says the document contains invalid characters. The document loads fine with Chinese characters in a node value, but not in an attribute value. I have tried setting the encoding to UTF-8 and UTF-16, but neither solve...
11
10163
by: bleedledeep | last post by:
I've been tracking down a memory leak using DevPartner 7.2 and what I am seeing is that calling XmlDocument.Load() leaks A LOT of memory. The following code is called when I click a button on my test form. (this is test code I wrote to confirm the bug, not my actual code) private void button1_Click(object sender, System.EventArgs e) { XmlDocument xd = new XmlDocument();
0
1458
by: Giovanni | last post by:
Hi All, I am trying to use the XMLDocument.Load method to load an XML document from a web site (http://www.xxx.com/file.xml). As I am going through ISA and require Proxy authentication, I cannot seem to use any property on the XMLDocument object to specify such. I tried using the XML Resolver but to no avail. All I can specify there is the URLResolver and pass some credentials, but no proxy. I am using VB.NET 2005 PRO, and will...
2
1854
by: supercodepoet | last post by:
I have cXml document I want to load to parse. The document has a DOCTYPE element that points to an external dtd via http. When the document loads it trys a web request which I am assuming is to get the dtd. We have a proxy and this throws and exception when trying to load the document becuase it could not authenticate through the proxy. Is there anyway I can turn off the download?
10
13966
by: lamxing | last post by:
Dear all, I've spent a long time to try to get the xmldocument.load method to handle UTF-8 characters, but no luck. Every time it loads a document contains european characters (such as the one below, output from google map API), it always said invalid character at position 229, which I believe is the "ß" character. Can anyone point me to the right direction of how to load such documents using the xmldocument.load() method, or...
4
1691
by: DanThMan | last post by:
The following code works when I debug and when I install the software and run the .exe, but if I try to open the form in the designer (which causes this code to run), I get an error: Private Sub LoadTestSettings() Dim rootPath As String Dim eventHandler As ValidationEventHandler rootPath = My.Application.Info.DirectoryPath eventHandler = New ValidationEventHandler(AddressOf XmlValidationEventHandler)
5
3718
by: Mahmoud Al-Qudsi | last post by:
Is there any way to stop an XmlDocument object from using data grabbed from a previous request? e.g. if I used XmlDocument.Load to grab a URI, and I know that this URI changes often (for example, an RSS feed) can I somehow tell the framework to not use cached data? Will I have to create a custom HttpWebRequest and convert the data to an XmlDocument for processing or is there some way to tell XmlDocument (perhaps via the XmlResolver...
0
8687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8884
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.