Re: Creating directories on Vista machines using .NET
- From: "Patrice" <http://www.chez.com/scribe/>
- Date: Fri, 11 May 2007 13:09:49 +0200
Even in XP, AFAIK you can't create a directory in "program files" (is this
where your executable is ?) under a non administrative account. Depending on
what you are trying to store, I would rather try another location...
Else what is the error you get ?
"Steve Barker" <stevebarker@xxxxxxxxxxxxx> a écrit dans le message de news:
FC7E57C4-0FED-400F-A0D4-784E66E596C3@xxxxxxxxxxxxxxxx
Hi guys,
I've noticed that simple .NET code to create directories does not seem to
work on Vista.
Take the following simple example (implemented in a Windows forms
application):
==========================
FileInfo executableFile = new FileInfo(Application.ExecutablePath);
DirectoryInfo directory =
executableFile.Directory.CreateSubdirectory("Test");
if (!directory.Exists)
{
directory.Create();
}
==========================
This works fine on XP, but not on Vista, despite the "belt and braces"
approach!
I guess this is to do with the improved security model in Vista. Clearly
there will be no way to override this in code (else it is useless in
preventing hackers from playing), but it would be good to find some kind
of
solution to this problem, even if that was popping up a box for the user
to
confirm that they're happy for Vista to perform the action.
Does anyone have any ideas as to how I can proceed?
Thanks in advance,
Steve.
.
- Follow-Ups:
- Re: Creating directories on Vista machines using .NET
- From: Steve Barker
- Re: Creating directories on Vista machines using .NET
- Prev by Date: Re: random dll names
- Next by Date: Re: Change default language from Visual Basic to C# in IDE.
- Previous by thread: DataGridView Invalidate Cell reply
- Next by thread: Re: Creating directories on Vista machines using .NET
- Index(es):
Relevant Pages
|