ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ASP.NET writing to a text file - Access denied

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#)
View previous topic :: View next topic  
Author Message
terri



Joined: 10 Oct 2004
Posts: 16

PostPosted: Sun Oct 10, 2004 10:18 am    Post subject: ASP.NET writing to a text file - Access denied Reply with quote

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
View user's profile Send private message
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Sun Oct 10, 2004 10:23 am    Post subject: Re: ASP.NET writing to a text file - Access denied Reply with quote

Welcome to our boards Terri Very Happy,

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
View user's profile Send private message
terri



Joined: 10 Oct 2004
Posts: 16

PostPosted: Sun Oct 10, 2004 10:49 am    Post subject: Reply with quote

It worked Smile !
Thanks for the help and the speedy reply!


Terri
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> .NET Programming (ASP.NET, VB.NET, C#) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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

SQL Tutorial