I have an ASP.NET application that attempts to write files on the web server during runtime. In my development environment, this works. However, when I deploy it to the production server, and I execute the code, I receive an error that states:
"Access to the path 'C:\Inetpub\wwwroot\MyWebApp\DirToWriteTo\' is denied."
My production server is a Window Server 2003 machine. The web application is set to allow anonymous access via the IUSR_TEMPLATE account.
What am I doing wrong?
Thank you!
You need provide the grant permissions to NETWORK SERVICE user.
you can check this link:-
http://repeatgeek.com/technical/asp-net-access-to-path-is-denied/
The most likely problem is that your anonymous user does not have write access to the location.
What I would do is create a web.config
entry for the location you want to write to and use that config key as your writable directory. This will allow you to have separate configuration for your production server and your development machine, if needed.
Next, just give write access to the directory defined in your configuration to the user IUSER_TEMPLATE
, or as Thorarin said the Network Service, in which case you should set up identity impersonation in your Web.config so that you can specify the user (unless you configure the user through the app pool). That should fix the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With