View previous topic :: View next topic |
Author |
Message |
terri
Joined: 10 Oct 2004 Posts: 16
|
Posted: Sun Oct 10, 2004 10:18 am Post subject: ASP.NET writing to a text file - Access denied |
|
|
Hi,
I'm trying to write to a text file from ASP.NET and I get "Access Denied" error. I know my code is correct, because I downloaded it from an online article. I can read from this file, and it seems that writing to it it's the only problem.
Any ideas what's wrong?
Terri |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Sun Oct 10, 2004 10:23 am Post subject: Re: ASP.NET writing to a text file - Access denied |
|
|
Welcome to our boards Terri ,
ASP.NET runs off it's own system account (ASPNET user group in IIS) that's why you need to use impersonation in order to be able to write to your file from ASP.NET.
To impersonate the ASPNET account just add the following line to your web.config:
<identity impersonate="true"/>
between <system.web> and </system.web>
This way the ASP.NET application will run under the IUSR_MACHINENAME account, which most likely already has write permissions.
terri wrote: | Hi,
I'm trying to write to a text file from ASP.NET and I get "Access Denied" error. I know my code is correct, because I downloaded it from an online article. I can read from this file, and it seems that writing to it it's the only problem.
Any ideas what's wrong?
Terri |
_________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
terri
Joined: 10 Oct 2004 Posts: 16
|
Posted: Sun Oct 10, 2004 10:49 am Post subject: |
|
|
It worked !
Thanks for the help and the speedy reply!
Terri |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|