Read\Update XML file

Discussion in 'ASP .Net Web Services' started by siaj, Feb 17, 2005.

  1. siaj

    siaj Guest

    Hi..
    I m just trying to learn using XML file as a datastore.

    I am reading a dataset from a XML file and then trying to update the XML
    file with some changes in the dataset.
    My code is as follwoing.

    Private Sub ReadUpdateData()
    Dim dsUser As New DataSet
    dsUser.ReadXml(Server.MapPath("Datafiles\Users.xml"))
    DataGrid1.DataSource = dsUser
    DataGrid1.DataBind() 'Read data

    dsUser.Tables(0).Rows(0).Item(1) = "xyz" 'changed value
    dsUser.WriteXml(Server.MapPath("Datafiles\Users.xml"))
    End Sub

    The Above code gives me error as Access to the path
    "C:\...\Datafiles\Users.xml" is denied


    any help will be highly aprreciated.

    Cheers,
    siaj
     
    siaj, Feb 17, 2005
    #1
    1. Advertising

  2. siaj

    Lionel LASKE Guest

    Check user permission on your directory or change your virtual directory
    security permission.
    By default, the anonymous ASPNET user had no write access on the virtual
    directory.

    Lionel.

    "siaj" <> a écrit dans le message de news:
    ...
    > Hi..
    > I m just trying to learn using XML file as a datastore.
    >
    > I am reading a dataset from a XML file and then trying to update the XML
    > file with some changes in the dataset.
    > My code is as follwoing.
    >
    > Private Sub ReadUpdateData()
    > Dim dsUser As New DataSet
    > dsUser.ReadXml(Server.MapPath("Datafiles\Users.xml"))
    > DataGrid1.DataSource = dsUser
    > DataGrid1.DataBind() 'Read data
    >
    > dsUser.Tables(0).Rows(0).Item(1) = "xyz" 'changed value
    > dsUser.WriteXml(Server.MapPath("Datafiles\Users.xml"))
    > End Sub
    >
    > The Above code gives me error as Access to the path
    > "C:\...\Datafiles\Users.xml" is denied
    >
    >
    > any help will be highly aprreciated.
    >
    > Cheers,
    > siaj
     
    Lionel LASKE, Feb 18, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2lhag==?=

    Read\update xml file

    =?Utf-8?B?c2lhag==?=, Feb 17, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    6,136
    =?Utf-8?B?c2lhag==?=
    Feb 17, 2005
  2. Mike

    read and update XML file

    Mike, Jul 14, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    350
  3. Christopher Aldridge
    Replies:
    0
    Views:
    136
    Christopher Aldridge
    Aug 9, 2005
  4. Alex Dowad
    Replies:
    4
    Views:
    316
    Michel Demazure
    May 1, 2010
  5. Erik Wasser
    Replies:
    5
    Views:
    520
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page