Wednesday, March 21, 2012

Permissions Problem?

I'm getting the following error on my web application, and Im really confused to as what the problem could be. My application pool is running under network services.

System.IO.DirectoryNotFoundException: Could not find a part of the path "E:\".

Here is the code that is causing the problem. Any suggestions?

'lets create the directory incase it doesnt exist
If Directory.Exists(ConfigurationSettings.AppSettings("rootDir") & "extrapics\" & subDir1 & "\") = False Then
Directory.CreateDirectory(ConfigurationSettings.AppSettings("rootDir") & "extrapics\" & subDir1 & "\")
End If

Any tips are greatly appreciated..

Thanks,
MikeIs this running on your machine? Is E a hard drive, or is it a network drive?

Brian
Hi Brian, - thanks for the response.

The E: is in fact on my machine, yes. Other applications are successfully running on it as well

Thanks again
mike123
Did you try writing out the full path to see where it was going? Maybe there is an error in the path:

Response.Write(ConfigurationSettings.AppSettings("rootDir") & "extrapics\" & subDir1 & "\")

Also, is this web application going to always run on your machine? If not, shared paths \\machine instead of e:\ are preferred.

Brian
Hi Brian,

This web application is always going to run on machine yes. I initially thought it was an error in the path as well due to the error return message however I have double checked and the path is perfectly fine.

Any ideas?

Thanks again
mike123
Does the ASPNET account have the permissions, or if your app declares impersonation, does that account have permissions?

Brian
Hi Brian,

The ASPNET account only has read access. My app does not declare impersonation I believe because I did not set it up. It would be in the web.config if configured for this, correct?

Internet Guest Account and Network Services have all permissions except full control.

Is this setup wrong? My Application pool is running under network services

Thanks very much for your help,

Mike123
anyone got any thoughts on this ? .. im COMPLETELY stuck :(
Are you running windows 2003?
Have you tried granting read access to the "network service" account?

Regards
Fredr!k
Hi Fredrik2000,

Yes I am running windows 2003, and yes the network service has read access. I thought this might be the problem too, but does not seem to be.

Thanks for the help, any other suggestions are warmly welcomed :)

Mike123
is there any other account I can give permissions to test on?
Is e: your system drive?
Is there a policy for folder traversal (is that the name), what I mean is if your user has
correct rights to a subdirectory and not to one of the folders it is located in...

Regards
Fredr!k
Hi Fredrik2000,

Yes, the E: is a system drive.

As far as folder traversal (if thats what its called ;)), I set the permissions at the root level to help debug this with still no luck.

I just gave "Everyone" full control, and its still not working. I've debugged the values passed to the createdirectory procedure, and the path is correct.

I'm totally stuck on where to go with this . Any ideas?

Thanks again,
Mike123

0 comments:

Post a Comment