network folder is read-only even though file attribute says its writeable

  • Thread starter Thread starter James Maeding
  • Start date Start date
J

James Maeding

I am familiar with using My.Computer.FileSystem.GetDirectoryInfo to get folder attributes, see code below...
This does not work though for network drives on my companies system.
We use windows as our server, nothing exotic.
I looked at the security permissions and the "write" box for domain users was grey, but not checked.
This means read-only to me and sure enough, I cannot change the files.
Is there a different way to deal with permissions controlling read-write property of folders?
thanks

Public Function IsFldrReadOnly(ByVal path As String) As Boolean
Dim reader As System.IO.DirectoryInfo
reader = My.Computer.FileSystem.GetDirectoryInfo(path)
If (reader.Attributes And System.IO.FileAttributes.ReadOnly) > 0 Then
Return True
Else
Return False
End If
End Function
 
James,

You're company have have applied a security policy to the network drives as
a precaution.

Bruce
 
right, no question about it.
Does everone get around this by trying to write a file to the folder as a test?
I did that and it works well, but its not elegent to say the least.
code:

Public Function IsFldrReadOnly(ByVal path As String) As Boolean
Dim ret As Boolean = True
Try
Dim file As System.IO.FileStream
file = System.IO.File.Create(path & "\TestDummy1234.txt")
file.Close()
System.IO.File.Delete(path & "\TestDummy1234.txt")
ret = False
Catch ex As Exception
End Try
Return ret
End Function

"Bruce W. Darby" <[email protected]>
|>James,
|>
|>You're company have have applied a security policy to the network drives as
|>a precaution.
|>
|>Bruce
|>
|>|>>I am familiar with using My.Computer.FileSystem.GetDirectoryInfo to get
|>>folder attributes, see code below...
|>> This does not work though for network drives on my companies system.
|>> We use windows as our server, nothing exotic.
|>> I looked at the security permissions and the "write" box for domain users
|>> was grey, but not checked.
|>> This means read-only to me and sure enough, I cannot change the files.
|>> Is there a different way to deal with permissions controlling read-write
|>> property of folders?
|>> thanks
|>>
|>> Public Function IsFldrReadOnly(ByVal path As String) As Boolean
|>> Dim reader As System.IO.DirectoryInfo
|>> reader = My.Computer.FileSystem.GetDirectoryInfo(path)
|>> If (reader.Attributes And System.IO.FileAttributes.ReadOnly) > 0
|>> Then
|>> Return True
|>> Else
|>> Return False
|>> End If
|>> End Function
|>
 
James,

Wish I had an answer for you. Security policies are notorious for getting in
the way of good folks trying to do their work while not seeming to foil too
many folks that are trying to do a dastardly thing. I'm familiar with them
only because my job entails working with customer's whose IT dept has a
policy in place. The only way that I'm aware that this issue can be resolved
is for the folks that made the policy in the first place need to allow you
to modify the policy or bypass it in certain development areas so that you
can accomplish your task. Perhaps someone else here can give you a better
alternative.

Bruce
 
Back
Top