tags:

views:

23

answers:

1

Hi,

I have a website hosted in IIS at location C:/inetpub/wwwroot/sample

and there is a folder in sample C:/inetpub/wwwroot/sample/work

I can neither read nor write a file in this work folder. I am using C# to read and write. I have set the NTFS permissions to full access, yet the problem.

Please Help Thanks

+2  A: 

It probably is related to a problem with ACLs, when you run it inside Visual Studio WebDev Server it runs using your identity, and if using Visual Studio in an elevated way (Vista+) then you actually might be running as administrator. When you run it in IIS it runs as a service identity, usually Network Service for IIS 6 and 7, or AppPool Identity for IIS 7 SP2 and IIS 7.5. One thing that I would recommend is to add some tracing information to the code that is trying to write the file, for example do a try/catch where the exception is sent to trace so that you can enable tracing and determine if an exception is happening or not. Also make sure that you are using the right physical path since you could also be having issues with relative paths, since IIS will probably resolve them to system32 if you are not using Server.MapPath or something similar.

CarlosAg
+1 for this is one way to go...
ydobonmai