469,328 Members | 1,281 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

XmlDocument.Load() and relative URL

Hi all

I'm creating an XmlDocument object and then i need to load its xml
content from an url which returns an xml stream
My problem is that i cannot use absolute URL but *relative* URL
i.e.
oXmlDoc.Load("../xml/genxml.aspx");

I know that
oXmlDoc.Load(http://xx.xx.xx.xx/site/xml/genxml.aspx);
and oXmlDoc.Load(this.Page.Server.MapPath("myfile.xml" ));
are working

But how can specify that the string parameter is a relative url and not
a full path ?

Thanks in advance

Elian Chrebor
--
// myLittleTools.net : leading provider of web-based applications.
// myLittleAdmin : online MS SQL manager
// http://www.mylittletools.net
// we*******@mylittletools.net
Nov 12 '05 #1
2 8987


el.c. - myLittleTools.net wrote:

I'm creating an XmlDocument object and then i need to load its xml
content from an url which returns an xml stream
My problem is that i cannot use absolute URL but *relative* URL
i.e.
oXmlDoc.Load("../xml/genxml.aspx");


A relative URI needs a base URI to resolve it so perhaps within ASP.NET
oXmlDoc.Load(new Uri(Request.Url, "../xml/genxml.aspx").ToString())
works for you.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Martin Honnen wrote:
el.c. - myLittleTools.net wrote:
I'm creating an XmlDocument object and then i need to load its xml
content from an url which returns an xml stream
My problem is that i cannot use absolute URL but *relative* URL
i.e.
oXmlDoc.Load("../xml/genxml.aspx");


A relative URI needs a base URI to resolve it so perhaps within
ASP.NET oXmlDoc.Load(new Uri(Request.Url,
"../xml/genxml.aspx").ToString()) works for you.


That perfectly works !
Thanks a lot for this prompt help !

best regards
elian chrebor
--
// myLittleTools.net : web-based applications for ASP developers
// myLittleAdmin v2.7 released !!
// More info on http://www.myLittleTools.net/
// we*******@mylittletools.net
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ayende Rahien | last post: by
2 posts views Thread by Graham Pengelly | last post: by
5 posts views Thread by Rob Panosh | last post: by
1 post views Thread by Gustaf | last post: by
4 posts views Thread by =?Utf-8?B?TWFyaw==?= | last post: by
1 post views Thread by fengtso | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.