File.SetAttributes problem

  • Thread starter Thread starter Bruce Lawson
  • Start date Start date
B

Bruce Lawson

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top