PDA

View Full Version : Writing to an XML File Within an .aspx page


villagecirc
12-02-2003, 09:32 AM
When I open a database to use the dataset.WriteXML(xml path name) within a C# visual studio web aplication I am unsure what the path should be. The default path is pointing to the location of the virtual directory on my home PC not the server default path. I tried useing a similiar path that connected the database itself that resided in the webconfig file like this
MYDS.WriteXml("E:/web/villagecirc/BTUpdate/Event.xml");

I am assuming that this path is probably probing my E: drive which is a cdr but all joking aside is their anyway to go about pointing in to a the server path instead of my home pc path. If anyone has successfully written to a xml file I would greatly apreciate any and all help in the matter. I was able to write the xml file as a local host housing the xml file on my home pc. So I completely know that it is a path problem but do not know how to go about pointing to the right server path. Even if I did I wonder if the server would restrict access to the xml file as it does not have general write procedures. Perhaps their is an applied path funtion I can use.

Thank you in advance for any and all help in the matter....[8D]

Matthew H. Paulson
matt@villagecircle.net
http://www.villagecircle.net

bruce
12-03-2003, 11:27 AM
The path you are using is incorrect.

You can find the path to your root in the account information section in the control panel.

I would not use physical path but rather opt for using Server.mappath function.

[b]quote:Originally posted by villagecirc

When I open a database to use the dataset.WriteXML(xml path name) within a C# visual studio web aplication I am unsure what the path should be. The default path is pointing to the location of the virtual directory on my home PC not the server default path. I tried useing a similiar path that connected the database itself that resided in the webconfig file like this
MYDS.WriteXml("E:/web/villagecirc/BTUpdate/Event.xml");

I am assuming that this path is probably probing my E: drive which is a cdr but all joking aside is their anyway to go about pointing in to a the server path instead of my home pc path. If anyone has successfully written to a xml file I would greatly apreciate any and all help in the matter. I was able to write the xml file as a local host housing the xml file on my home pc. So I completely know that it is a path problem but do not know how to go about pointing to the right server path. Even if I did I wonder if the server would restrict access to the xml file as it does not have general write procedures. Perhaps their is an applied path funtion I can use.

Thank you in advance for any and all help in the matter....[8D]

Matthew H. Paulson
matt@villagecircle.net
http://www.villagecircle.net
</blockquote id="quote"></font id="quote">

villagecirc
12-04-2003, 12:04 PM
Hey bruce I was wondering if you could display the function in context.


When I use the Server.MapPath function do I need to pass it my root server path?

//string sPath = Server.MapPath();
//this.lblPath.text = sPath;

Matthew H. Paulson
matt@villagecircle.net
http://www.villagecircle.net

bruce
12-04-2003, 12:40 PM
If you want to access a file in your web root

Server.Mappath("/myfile.txt")

this should give you (on our server), e:\web\userid\htdoc\myfile.txt

[b]quote:Originally posted by villagecirc

Hey bruce I was wondering if you could display the function in context.


When I use the Server.MapPath function do I need to pass it my root server path?

//string sPath = Server.MapPath();
//this.lblPath.text = sPath;

Matthew H. Paulson
matt@villagecircle.net
http://www.villagecircle.net
</blockquote id="quote"></font id="quote">

villagecirc
12-06-2003, 11:22 AM
thank you thats says it all....[8D]

Matthew H. Paulson
matt@villagecircle.net
http://www.villagecircle.net