G
Guest
Please HELP !!
I have a web page that is trying to create folders on a file server
eg. \\SERVERNAME\F4\Projects\[New Folder Name]
Users of the web site are authenticated with Windows Integrated Security.
(have tried on W2003/IIS6 and W2k/IIS5 with no difference in behavoir)
When a user connects to the using a browser on the same machine as the
webserver the code works and is able to create the new folder.
When the same user connects from a remote machine the CreateDirectory
function generates the following Exception
System.UnauthorizedAccessException
"Access to the path \"TEST\" is denied."
Source "mscorlib"
StackTrace
System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String
path)\r\n
....
I have tried to do this in 3 ways all with the same problem;
A)
DirectoryInfo di = Directory.CreateDirectory(newfullpath);
B)
DirectoryInfo root = new DirectoryInfo(rootPath);
DirectoryInfo di = root.CreateSubdirectory(folderName);
C)
[DllImport("kernel32.dll")]
static extern bool CreateDirectory(string lpPathName, IntPtr
lpSecurityAttributes);
....
bool result = CreateDirectory(path, IntPtr.Zero);
DirectoryInfo di = DirectoryInfo(path);
I have also checked that the Integrated Authentication is getting passed
correcty into the application
string origID = Thread.CurrentPrincipal.Identity.Name;
string contextUser = HttpContext.Current.User.Identity.Name;
Both call return the same user regardless if the call is from the server or
a remote machine.
Needless to say that the User has the required permissions to create the
folder because they are able to do so as long as they do it from a browser on
the server itself.
If anyone can shed any light on what is going on here I would greatly
appreciate it.
Regards,
David Davies
Goldman Sachs
I have a web page that is trying to create folders on a file server
eg. \\SERVERNAME\F4\Projects\[New Folder Name]
Users of the web site are authenticated with Windows Integrated Security.
(have tried on W2003/IIS6 and W2k/IIS5 with no difference in behavoir)
When a user connects to the using a browser on the same machine as the
webserver the code works and is able to create the new folder.
When the same user connects from a remote machine the CreateDirectory
function generates the following Exception
System.UnauthorizedAccessException
"Access to the path \"TEST\" is denied."
Source "mscorlib"
StackTrace
System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String
path)\r\n
....
I have tried to do this in 3 ways all with the same problem;
A)
DirectoryInfo di = Directory.CreateDirectory(newfullpath);
B)
DirectoryInfo root = new DirectoryInfo(rootPath);
DirectoryInfo di = root.CreateSubdirectory(folderName);
C)
[DllImport("kernel32.dll")]
static extern bool CreateDirectory(string lpPathName, IntPtr
lpSecurityAttributes);
....
bool result = CreateDirectory(path, IntPtr.Zero);
DirectoryInfo di = DirectoryInfo(path);
I have also checked that the Integrated Authentication is getting passed
correcty into the application
string origID = Thread.CurrentPrincipal.Identity.Name;
string contextUser = HttpContext.Current.User.Identity.Name;
Both call return the same user regardless if the call is from the server or
a remote machine.
Needless to say that the User has the required permissions to create the
folder because they are able to do so as long as they do it from a browser on
the server itself.
If anyone can shed any light on what is going on here I would greatly
appreciate it.
Regards,
David Davies
Goldman Sachs