Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Regarding reading and Writing xmlfile after deployment

Regarding reading and Writing xmlfile after deployment

Scheduled Pinned Locked Moved C#
helpsysadminxmlworkspace
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rahuladya
    wrote on last edited by
    #1

    hello froum I am writing the elements to xml file on runtime,and also using them. It is working properly.

    XmlDocument xmlDoc = new XmlDocument();
    string path = AppDomain.CurrentDomain.BaseDirectory + @"\XMLFind.xml";
    xmlDoc.Load(path);
    XmlNodeList xmlNS = xmlDoc.GetElementsByTagName("testword");

    The xml file is in the bin folder. but the problem is after creating setup the xml file is visible to every body so it can be deleted accidently. If the xml file is placed in the project then while using the output (after creating its setup) it gives the runtime error Could not find the C:\Program Files\hts\SetupFinal\XMLFind.xml. can anybody help me... Regards Rahul Adya

    N 1 Reply Last reply
    0
    • R rahuladya

      hello froum I am writing the elements to xml file on runtime,and also using them. It is working properly.

      XmlDocument xmlDoc = new XmlDocument();
      string path = AppDomain.CurrentDomain.BaseDirectory + @"\XMLFind.xml";
      xmlDoc.Load(path);
      XmlNodeList xmlNS = xmlDoc.GetElementsByTagName("testword");

      The xml file is in the bin folder. but the problem is after creating setup the xml file is visible to every body so it can be deleted accidently. If the xml file is placed in the project then while using the output (after creating its setup) it gives the runtime error Could not find the C:\Program Files\hts\SetupFinal\XMLFind.xml. can anybody help me... Regards Rahul Adya

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      rahuladya wrote:

      but the problem is after creating setup the xml file is visible to every body so it can be deleted accidently.

      There is no way to secure it. Just check the file existence before you read it and tell user if it is not available.

      Navaneeth How to use google | Ask smart questions

      R 1 Reply Last reply
      0
      • N N a v a n e e t h

        rahuladya wrote:

        but the problem is after creating setup the xml file is visible to every body so it can be deleted accidently.

        There is no way to secure it. Just check the file existence before you read it and tell user if it is not available.

        Navaneeth How to use google | Ask smart questions

        R Offline
        R Offline
        rahuladya
        wrote on last edited by
        #3

        hello navneeth Yes i know but the issue is not here, we can secure it by adding it to solution explorer and after creating setup it will not be visible to anybody. The problem is how to find the xml file present in the project on runtime because the directory path will be changed after deployment. Rahul adya

        N 1 Reply Last reply
        0
        • R rahuladya

          hello navneeth Yes i know but the issue is not here, we can secure it by adding it to solution explorer and after creating setup it will not be visible to anybody. The problem is how to find the xml file present in the project on runtime because the directory path will be changed after deployment. Rahul adya

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          rahuladya wrote:

          because the directory path will be changed after deployment.

          Place it in the application directory. Application.ExecutablePath will give you the current directory where application's exe resides.

          Navaneeth How to use google | Ask smart questions

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups