G
Guest
I need to make sure a file in my site's directory structure is not read-only.
The following code runs after I grant permission to ASPNET on the folder,
but the attribute is not removed (no exceptions thrown).
Dim filePath As String = "c:\inetpub\wwwroot\Test\fileName.xls"
If (File.GetAttributes(xlsTemplateFile) And FileAttributes.ReadOnly) =
FileAttributes.ReadOnly Then
File.SetAttributes(xlsTemplateFile, File.GetAttributes(xlsTemplateFile) Or
FileAttributes.ReadOnly)
End If
The following code runs after I grant permission to ASPNET on the folder,
but the attribute is not removed (no exceptions thrown).
Dim filePath As String = "c:\inetpub\wwwroot\Test\fileName.xls"
If (File.GetAttributes(xlsTemplateFile) And FileAttributes.ReadOnly) =
FileAttributes.ReadOnly Then
File.SetAttributes(xlsTemplateFile, File.GetAttributes(xlsTemplateFile) Or
FileAttributes.ReadOnly)
End If