473,467 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to specify proxy/authority for XmlDocument.Load()

Hi All,

I am trying to access xml-files in the internet from my intranet-page.
Making XmlDocument.Load() 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*************@manfbraun.de
(Remove the anti-spam-underscore to mail me!)

Nov 11 '05 #1
2 11983
Manfred Braun wrote:
I am trying to access xml-files in the internet from my intranet-page.
Making XmlDocument.Load() 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.Create("http://msdn.microsoft.com/rss.xml");

bool useProxy =
Boolean.Parse(System.Configuration.ConfigurationSe ttings.AppSettings["usePro
xy"]);
if(useProxy)
{
string address, port, username, password, domain;
address =
System.Configuration.ConfigurationSettings.AppSett ings["address"];
port = System.Configuration.ConfigurationSettings.AppSett ings["port"];
username =
System.Configuration.ConfigurationSettings.AppSett ings["username"];
password =
System.Configuration.ConfigurationSettings.AppSett ings["password"];
domain =
System.Configuration.ConfigurationSettings.AppSett ings["domain"];

WebProxy myProxy = new WebProxy(address, Int32.Parse(port));
myProxy.BypassProxyOnLocal = true;
NetworkCredential myCred = new NetworkCredential(username, password,
domain);
myProxy.Credentials = myCred;

objRequest.Proxy = myProxy;
}

WebResponse objResponse = objRequest.GetResponse();
oSR = new StreamReader(objResponse.GetResponseStream());
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_PLEASEtkachenko.com> wrote in message
news:Ox**************@TK2MSFTNGP12.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
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...
8
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: ...
1
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...
11
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...
0
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...
2
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...
10
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...
4
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...
5
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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...

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.