how do you write out a file?
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-io' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Karen Healey
Hi,

I am trying to write out XML data to a file and get an error. Specifically, I have a dataset and I want to write the dataset to a file. Then I want to email the file as an attachment. But when I create the dataset using WriteXml, I get this error:

System.UnauthorizedAccessException: Access to the path "C:\WINDOWS\system32\test1.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.

Even if I call the file "c:\test1.xml" I still get this error so it has nothing to do with the file name. I understand that the process is not authorized. So I have more of a general question.... how does a web page write a file? Where is the file being written? On the users PC or on the web server? If its the web server, then is there any reason why my process should not have privileges? HOw does one go about setting these privileges? If on the users PC, is there some temp directory I should be using that will always have access?

Please forgive my ignorance... total beginner here!

Thanks,

Karen Healey
Click here to reveal e-mail address
(508) 473-1218
Reply to this message...
 
    
Mitch Denny (VIP)
Hi,

I am trying to write out XML data to a file and get an error. Specifically, I have a dataset and I want to write the dataset to a file. Then I want to email the file as an attacment. But when I create the dataset using WriteXml, I get this error:

System.UnauthorizedAccessException: Access to the path "C:\WINDOWS\system32\test1.xml" is denied.

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

Even if I call the file "c:\test1.xml" I still get this error so it has
�othing to do with the file name. I understand that the process is
not �uthorized. So I have more of a general question.... how does a
web �age write a file? Where is the file being written? On the users
PC or �n the web server? If its the web server, then is there any
reason why �y process should not have privileges? HOw does one go
about setting �hese privileges? If on the users PC, is there some
temp directory I �hould be using that will always have access?

Please forgive my ignorance... total beginner here!

Thanks,

Karen Healey
Click here to reveal e-mail address
(508) 473-1218
Reply to this message...
 
 
System.UnauthorizedAccessException




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com