How can I determine if I have write permission on a remote machine in my intranet using C# in .Net?
The simple answer would be to try it and see. The Windows security APIs are not for the faint of heart, and may be possible you have write permission without having permission to view the permissions!
Been there too, the best and most reliable solution I found was this:
bool hasWriteAccess = true;
string remoteFileName = "\\server\share\file.name"
try
{
createRemoteFile(remoteFileName);
}
catch (SystemSecurityException)
{
hasWriteAccess = false;
}
if (File.Exists(remoteFileName))
{
File.Delete(remoteFileName);
}
return hasWriteAccess;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With