p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Access denied, can't create xml file from ASP.NET (http://p2p.wrox.com/showthread.php?t=25827)

goldablasha February 21st, 2005 01:41 AM

Access denied, can't create xml file from ASP.NET
hi everyone,
i am trying to create a .xml file from a ASP.NET web application but i keep getting this error.

Access to the path "c:\inetpub\wwwroot\Weblog1Entries\20050221_0207.x ml"
is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path "c:\inetpub\wwwroot\Weblog1\Entries\20050221_0207. xml" is denied.

The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited privileges. Consider granting access rights to the resource to the ASP.NET process identity.

Source Error:

95 fileInfo.Delete();
96 FileStream stream = new FileStream(filepath, FileMode.Create);
97 XmlSerializer serializer = new XmlSerializer(this.GetType());
98 serializer.Serialize(stream, this);

Source File: c:\inetpub\wwwroot\weblog1\entry.cs Line: 96


i was getting the same error when trying to open .xml file, but i added the property 'FileAccess.read' to the stream constructor and it was ok. This time its not working!

thanks already...

mehdi62b February 21st, 2005 04:12 PM

Grant the Write permission to your ASP.NET account for that folder.

software student.

goldablasha February 21st, 2005 04:32 PM

thanks...it worked!
you helped a lot.

rahimzai February 27th, 2007 05:50 AM

i am trying to do this too but is not working. i granted permission to ASP.NET account for to write in a XML file, but still it says " Access Denied!" what shall i do?


All times are GMT -4. The time now is 08:11 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.