472,102 Members | 2,103 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

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 9248


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
reply views Thread by leo001 | last post: by

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.