J
John
Hello,
I am having a permissions problem when creating a directory. The relevant
bits of my code look like this:
// impersonate current user:
WindowsIdentity ident = (WindowsIdentity)
HttpContext.Current.User.Identity;
_context = ident.Impersonate();
_name = ident.Name;
_isauth = ident.IsAuthenticated;
_authtype = ident.AuthenticationType;
// create the directory
// I've also tried using DirectoryInfo.Create()
Directory.CreateDirectory(directoryName);
// restore current (aspnet) identity:
_context.Undo();
If "directoryname" is "e:\inetpub\wwwroot\unittests\createdirectory\New" I
am getting the error Could not find a part of the path "e:\".
If I grant this user access to the root of my "e" drive then it works
fine. However, doing this is a security risk (and also, to me, seems
completely unnecessary).
Does anyone know why this happens and if there is a sensible way round
it? Is this a .net bug?
Any help would be very much appreciated as I am completely stumped!
Thanks,
John
I am having a permissions problem when creating a directory. The relevant
bits of my code look like this:
// impersonate current user:
WindowsIdentity ident = (WindowsIdentity)
HttpContext.Current.User.Identity;
_context = ident.Impersonate();
_name = ident.Name;
_isauth = ident.IsAuthenticated;
_authtype = ident.AuthenticationType;
// create the directory
// I've also tried using DirectoryInfo.Create()
Directory.CreateDirectory(directoryName);
// restore current (aspnet) identity:
_context.Undo();
If "directoryname" is "e:\inetpub\wwwroot\unittests\createdirectory\New" I
am getting the error Could not find a part of the path "e:\".
If I grant this user access to the root of my "e" drive then it works
fine. However, doing this is a security risk (and also, to me, seems
completely unnecessary).
Does anyone know why this happens and if there is a sensible way round
it? Is this a .net bug?
Any help would be very much appreciated as I am completely stumped!
Thanks,
John