Groups | Blog | Home
all groups > asp.net > february 2006 >

asp.net : File.SetAttributes problem


Bruce Lawson
2/27/2006 11:08:44 PM
Hi All,
I've modified a simple Aspnet program from a text to show file information,
including attributes and I keep getting an error which I cannot seem to
solve; here's the important parts:
Imports System
Imports System.IO
Imports System.IO.DirectoryInfo
Imports System.IO.File
Imports System.IO.FileAttributes
............
Private Sub PageLoad()
Dim f as new FileInfo("file path")............
'change file attributes to hidden or archive just for kix
'File.SetAttributes(path, FileAttributes.Archive)
'File.SetAttributes(path, FileAttributes.Hidden)
'f.Attributes = 2
'f.Attributes = FileAttributes.Hidden
'none of these work,
The program compiles fine, but kicks out on run with this error:
System.ArgumentException: Invalid File or Directory attributes value. When
the error lines above are commented out, the program runs fine. Any help is
much appreciated.
BruceL

DWS
3/1/2006 6:55:30 AM
Bruce,
First off you need an existing file path
I'm pointing f to app_data/lawsonfiles (you create this folder)

Dim f as new FileInfo(server.mappath("~/app_data/Lawsonfiles/"))

Good Luck
DWS




[quoted text, click to view]
AddThis Social Bookmark Button