I am trying to save an updated xml file to a url like this:
//save the output to a file
xmlDoc.Save("http://www.example.com/HomeNewsLinks.xml");
But I get this error: URI formats are not supported.
Did some google search on this and it seems I need to use client.uploadFile method, but I am not able to find how to declare/define filenamexxx (below) and how to pass a username/password.
WebClient Client = new WebClient();
Client.UploadFile("http://www.example.com/HomeNewsLinks.xml", Post, [COLOR="Red"]filenamexxx[/COLOR]);
What are you trying to do? Post XML to a website or save an xml file to that url? If the latter, you cannot do that. You cannot overwrite files of a website. Imagine you just just overwrite the home.php file of facebook.
You will have to post plain xml to a page on that website and that website handle the saving of it or you need FTP it to the server. You can use FtpClient for that.
Obviously I dont know what the h3ll I am trying to do …
In the simplest sense, I am trying to store a very small amount of input data on one page, and display it on a different page. And I was trying to store the data in an XML file.
I know i could store it in a database, but I thought storing it in XML was a valid practice. Apparently not???
Dont be to hard on urself. Everyone has to start somewhere. Storing a small amount of data is definitely valid practice.
Just the way you are trying to save it is incorrect. You cannot use a url, you need to have a valid path. eg: D:\wwwroot\websites\uploads\HomeNewsLinks.xml.
So for the path for doc.Save method, you can do this:
xmlDoc.Save(Server.MapPath(“/HomeNewsLinks.xml”));
The map path gets the path to the current site. I hope this helps.
Yeah!!! I got it to work.
Stalker, thanks for the help again.
And thanks for the word of encouragement. I did mainframe work for 12 years and was recently laid off with the bad economy. I really want to be able to make a living doing web app development, but there is a lot to learn.
Sorry to here man. Yea things are tough atm. You right, there is a lot to learn, but it is easy to learn, it just takes time. But you will have it in no time.
Best of luck for the future