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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Get User Data from XML or web.config

Get User Data from XML or web.config

Scheduled Pinned Locked Moved ASP.NET
xmlquestion
4 Posts 3 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.
  • D Offline
    D Offline
    dubbele onzin
    wrote on last edited by
    #1

    Hello, I want to store some users in an XML file. A user has a username, a display name and a password. Do I need a separate XML file or can I use web.config? I need to list the users by username to populate a drop-down list and I also need to authenticate users by checking their passwords. Here is my sample users XML file: bj Bob Jones aaaa jd John Doe bbbb So I need to write two methods: 1. List each userid 2. Return the password for a named userid And is there any way of using the web.config for this so my system administrator can just use that rather than the separate users.xml file?

    P S D 3 Replies Last reply
    0
    • D dubbele onzin

      Hello, I want to store some users in an XML file. A user has a username, a display name and a password. Do I need a separate XML file or can I use web.config? I need to list the users by username to populate a drop-down list and I also need to authenticate users by checking their passwords. Here is my sample users XML file: bj Bob Jones aaaa jd John Doe bbbb So I need to write two methods: 1. List each userid 2. Return the password for a named userid And is there any way of using the web.config for this so my system administrator can just use that rather than the separate users.xml file?

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      Have a look at this article[^] on creating custom configuration sections in web.config.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      1 Reply Last reply
      0
      • D dubbele onzin

        Hello, I want to store some users in an XML file. A user has a username, a display name and a password. Do I need a separate XML file or can I use web.config? I need to list the users by username to populate a drop-down list and I also need to authenticate users by checking their passwords. Here is my sample users XML file: bj Bob Jones aaaa jd John Doe bbbb So I need to write two methods: 1. List each userid 2. Return the password for a named userid And is there any way of using the web.config for this so my system administrator can just use that rather than the separate users.xml file?

        S Offline
        S Offline
        SABhatti
        wrote on last edited by
        #3

        I don't know about web.config, but from separate xml file yes. 1. List each userid DataSet xmlDS = new DataSet(); xmlDS.ReadXml(xmlfilewithpath, XmlReadMode.Auto); gv.DataSource = xmlDS; // gv is a gridview control on the page gv.DataBind(); 2. Return the password for a named userid // new xml document XmlDocument xmlDoc = new XmlDocument(); // load the current file as XML document xmlDoc.Load(xmlfilewithpath) // get the password XmlNode curNode = xmlDoc.DocumentElement.SelectSingleNode("users/user[userid='jd']"); string pwd; if(curNode != null) pwd=curNode.SelectSingleNode("password").innerText;

        -----

        1 Reply Last reply
        0
        • D dubbele onzin

          Hello, I want to store some users in an XML file. A user has a username, a display name and a password. Do I need a separate XML file or can I use web.config? I need to list the users by username to populate a drop-down list and I also need to authenticate users by checking their passwords. Here is my sample users XML file: bj Bob Jones aaaa jd John Doe bbbb So I need to write two methods: 1. List each userid 2. Return the password for a named userid And is there any way of using the web.config for this so my system administrator can just use that rather than the separate users.xml file?

          D Offline
          D Offline
          dubbele onzin
          wrote on last edited by
          #4

          Thanks for the answers :)

          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