Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 21st, 2005, 01:41 AM
Registered User
 
Join Date: Feb 2005
Location: Rio de Janeiro, , Brazil.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to goldablasha
Default 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...


  #2 (permalink)  
Old February 21st, 2005, 04:12 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

_____________
Mehdi.
software student.
  #3 (permalink)  
Old February 21st, 2005, 04:32 PM
Registered User
 
Join Date: Feb 2005
Location: Rio de Janeiro, , Brazil.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to goldablasha
Default

thanks...it worked!
you helped a lot.
  #4 (permalink)  
Old February 27th, 2007, 05:50 AM
Authorized User
 
Join Date: Nov 2006
Location: islamabad, CT, Pakistan.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?

payab


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create word file in asp.net,c# mohini ASP.NET 2.0 Professional 11 March 1st, 2012 06:38 AM
Access is denied" load a simple xml file nana XML 12 May 12th, 2010 07:01 AM
Access Denied when I send fax in ASp.NET 2.0 patel_mitesh ASP.NET 2.0 Professional 0 September 20th, 2006 07:15 AM
Can I create my own File Field control in ASP.Net vbmazza ASP.NET 1.0 and 1.1 Professional 1 February 22nd, 2006 11:45 AM
access denied when uploading file daliaca BOOK: ASP.NET Website Programming Problem-Design-Solution 1 January 16th, 2005 11:08 AM





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