Re: Creating directories on Vista machines using .NET



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.



.



Relevant Pages

  • Re: Poor Performance With 4GB Memory
    ... I currently have 4 gb installed on Vista x86 and the performance tab in the task manager shows 3453 megs available - in other words 3.45 gb. ... The amount of available ram varies depending on how much address space must first be allocated to hardware. ... A large amount of ram on the video adapter is one of the main reasons for less available ram for the OS and applications. ...
    (microsoft.public.windows.vista.performance_maintenance)
  • Re: System.Privateprofilestring
    ... stuff on VISTA could it be that some Vista system protection service ... Unless you have administrator rights, attempts to write to a file in the ... Windows directory will fail. ... Depending on how it is set up and depending on ...
    (microsoft.public.word.vba.customization)
  • Re: Vista prelim system requirements
    ... out there will be several levels of compatability, depending on how ... much video card horsepower and memory you have to run ... about how hybrid hard disks will be a hard requirement for Vista ... again when Vista SP2 has been out for a year. ...
    (alt.sys.pc-clone.dell)
  • Re: There is no .NET in Vista Code?
    ... I thought Vista was not due out until Jan 2007 - who knows what it will ... If Vista doesn't contained .NET code itself does not mean ... No, I'd be more worried about Windows 2000 and, especially, XP - ... reporting components. ...
    (borland.public.delphi.non-technical)
  • Re: lost whole report!
    ... saved version depending on which version of Vista you are using. ... I think you may only get this with Vista Ultimate ... was nothing at the bottom to get me back to my report. ...
    (microsoft.public.office.misc)