Writing to an XML File Within an .aspx page

Discussion in 'Databases' started by villagecirc, Dec 2, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. 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
    [email protected]
    http://www.villagecircle.net
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    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.

    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
    [email protected]
    http://www.villagecircle.net
    </blockquote id="quote"></font id="quote">
     
  3. 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
    [email protected]
    http://www.villagecircle.net
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    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

    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
    [email protected]
    http://www.villagecircle.net
    </blockquote id="quote"></font id="quote">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page