|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Remove read-only from fileI 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 "smay" <s***@discussions.microsoft.com> schrieb: Your code is currently /setting/ the read-only bit.>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) 'Or' -> 'And Not'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||