writing XML file error

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default writing XML file error

    Hi,
    I get an error (Access to the path "C:\Inetpub\wwwroot\LE\SMS\Mesaj_One.xml"
    is denied.) when I do this:
    string filename =Request.PhysicalApplicationPath.ToString() +
    "/Mesaj_One.xml";
    FileStream myFileStream = new FileStream(filename,
    System.IO.FileMode.Create);
    XmlTextWriter myXmlWriter = new XmlTextWriter(myFileStream,
    System.Text.Encoding.Unicode);
    dsWrite.WriteXml(myXmlWriter);

    Any idea please,
    Thanks in advence,
    Salim


    Salim Afþar Guest

  2. Similar Questions and Discussions

    1. Writing a text file to the file system
      Using Visual Studio C# When I ran the following code: System.IO; private void Button1_Click(object sender, System.EventArgs e) {...
    2. Error writing ACP file
      I get an error when attempting to do a Paper Capture. Once the program reaches the "writing ACP file" I get an error. I feel certain the problem is...
    3. Setting the file permissions of a file I'm writing to
      Is it possible to specify the permissions of a file I create when I: open ("FOO", "> ./bar") or die ("Could not create file"); Thanks in...
    4. File Access error - writing to .txt file
      Normally web sites run under the ASPNET user account. It appears that this account does not have write privileges to the file path you've...
    5. A failure occurred writing to the resources file. Access is denied. -- RESX file is locked? -- WHY?
      Hi. This is an error that comes up fairly regularly when trying to run the "Rebuild All" command in a Solution that contains more than one...
  3. #2

    Default Re: writing XML file error

    The account under which your application is running doesn't have the
    necessary permission.
    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Big things are made up of
    lots of little things.

    "Salim Afþar" <safsar@luckyeye.com> wrote in message
    news:uDzl993TDHA.2420@TK2MSFTNGP10.phx.gbl...
    > Hi,
    > I get an error (Access to the path
    "C:\Inetpub\wwwroot\LE\SMS\Mesaj_One.xml"
    > is denied.) when I do this:
    > string filename =Request.PhysicalApplicationPath.ToString() +
    > "/Mesaj_One.xml";
    > FileStream myFileStream = new FileStream(filename,
    > System.IO.FileMode.Create);
    > XmlTextWriter myXmlWriter = new XmlTextWriter(myFileStream,
    > System.Text.Encoding.Unicode);
    > dsWrite.WriteXml(myXmlWriter);
    >
    > Any idea please,
    > Thanks in advence,
    > Salim
    >
    >

    Kevin Spencer Guest

  4. #3

    Default writing XML file error

    Hi
    Give ASP.NET User Account write permission on the web
    folder where you would like to create xml file.

    Ravikanth

    >-----Original Message-----
    >Hi,
    >I get an error (Access to the
    path "C:\Inetpub\wwwroot\LE\SMS\Mesaj_One.xml"
    >is denied.) when I do this:
    >string filename =Request.PhysicalApplicationPath.ToString
    () +
    >"/Mesaj_One.xml";
    >FileStream myFileStream = new FileStream(filename,
    >System.IO.FileMode.Create);
    >XmlTextWriter myXmlWriter = new XmlTextWriter
    (myFileStream,
    >System.Text.Encoding.Unicode);
    >dsWrite.WriteXml(myXmlWriter);
    >
    >Any idea please,
    >Thanks in advence,
    >Salim
    >
    >
    >.
    >
    Ravikanth[MVP] Guest

  5. #4

    Default Re: writing XML file error


    "Ravikanth[MVP]" <dvravikanth@hotmail.com> skrev i meddelandet
    news:07ae01c34f85$c2a39150$a101280a@phx.gbl...
    > Hi
    > Give ASP.NET User Account write permission on the web
    > folder where you would like to create xml file.
    How do you do that in WinXP Pro??? I can not find any security/access
    property settings.

    Jan
    >
    > Ravikanth
    >
    >
    > >-----Original Message-----
    > >Hi,
    > >I get an error (Access to the
    > path "C:\Inetpub\wwwroot\LE\SMS\Mesaj_One.xml"
    > >is denied.) when I do this:
    > >string filename =Request.PhysicalApplicationPath.ToString
    > () +
    > >"/Mesaj_One.xml";
    > >FileStream myFileStream = new FileStream(filename,
    > >System.IO.FileMode.Create);
    > >XmlTextWriter myXmlWriter = new XmlTextWriter
    > (myFileStream,
    > >System.Text.Encoding.Unicode);
    > >dsWrite.WriteXml(myXmlWriter);
    > >
    > >Any idea please,
    > >Thanks in advence,
    > >Salim
    > >
    > >
    > >.
    > >

    Jan Guest

  6. #5

    Default Re: writing XML file error

    If you're running XP Pro and your computer is not a member of a domain, you
    need to go into Control Panel, Folder Options. In the View tab, uncheck "Use
    Simple File Sharing" and you will be able to see the Security tab in your
    Folder Properties dialog boxes.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Big things are made up of
    lots of little things.

    "Jan" <jan@dejewski.com> wrote in message
    news:%23mZMOp5TDHA.3640@tk2msftngp13.phx.gbl...
    >
    > "Ravikanth[MVP]" <dvravikanth@hotmail.com> skrev i meddelandet
    > news:07ae01c34f85$c2a39150$a101280a@phx.gbl...
    > > Hi
    > > Give ASP.NET User Account write permission on the web
    > > folder where you would like to create xml file.
    >
    > How do you do that in WinXP Pro??? I can not find any security/access
    > property settings.
    >
    > Jan
    >
    > >
    > > Ravikanth
    > >
    > >
    > > >-----Original Message-----
    > > >Hi,
    > > >I get an error (Access to the
    > > path "C:\Inetpub\wwwroot\LE\SMS\Mesaj_One.xml"
    > > >is denied.) when I do this:
    > > >string filename =Request.PhysicalApplicationPath.ToString
    > > () +
    > > >"/Mesaj_One.xml";
    > > >FileStream myFileStream = new FileStream(filename,
    > > >System.IO.FileMode.Create);
    > > >XmlTextWriter myXmlWriter = new XmlTextWriter
    > > (myFileStream,
    > > >System.Text.Encoding.Unicode);
    > > >dsWrite.WriteXml(myXmlWriter);
    > > >
    > > >Any idea please,
    > > >Thanks in advence,
    > > >Salim
    > > >
    > > >
    > > >.
    > > >
    >
    >

    Kevin Spencer Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139