My HttpHandler doesn't want to create directory on a network

Posted by Daok on Stack Overflow See other posts from Stack Overflow or by Daok
Published on 2011-11-25T17:45:03Z Indexed on 2011/11/25 17:50 UTC
Read the original article Hit count: 341

Filed under:
|
|
|
|

I use this simple line of code inside my HttpHandler:

Directory.CreateDirectory(@"\\srv-001\dev\folderToCreate\");

I receive an UnauthoridezAccessException telling me that the access to the path is denied.

From here, I create a little Dos application in C# doing the same thing and I was able to create the folder. So, I thought that it might be that IIS is running on a different user than myself. I went to IIS and changed the Application pool to a Custom user, myself. But, unfortunately, I got the same exception.

I have try to create a Share folder on my computer and I can create directory. Also, when debugging I can see that System.Threading.Thread.CurrentPrincipal.Identity have its AuthenticationType to "", IsAuthenticated to false and name to "".

So, with all those tests I can conclude that the HttpHandler that receive the file cannot create a directory because of some security access.

How can I grand access to my HttpHandler to be able to create a directory (and files) to a network folder?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET