updating XML files on the Web

S

ShayHk

Hello
I created a webSite using a free web hosting space (that supports
asp.net applications).
The website was created with asp.net project
The problem is that I cant update XML files that are placed on the web
site . why?

for example :

fileName = "www.website.com/xmlFile.xml";
try {
doc = new XmlDocument();
doc.Load( fileName );
....
doc.Save( fileName ); // throw Exception !!! why ?
}

the excption message is : "URI formats are not supported."
How can I handle this?
 
L

Laurent Bugnion

Hi,
Hello
I created a webSite using a free web hosting space (that supports
asp.net applications).
The website was created with asp.net project
The problem is that I cant update XML files that are placed on the web
site . why?

for example :

fileName = "www.website.com/xmlFile.xml";
try {
doc = new XmlDocument();
doc.Load( fileName );
...
doc.Save( fileName ); // throw Exception !!! why ?
}

the excption message is : "URI formats are not supported."
How can I handle this?

You must save the file using the absolute path. You should be able to
get the absolute path from your provider. Alternatively, you can try
using MapPath:

fileName = "xmlFile.xml";
// "this" refers to the Page.
doc.Save( this.MapPath( fileName ) );

// if you're not in a Page, you can also use
doc.Save( HttpServerUtility.MapPath( fileName ) );

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top