AFAIK the situation is the same on Vista and Windows 7, and will continue to be so on newer versions of Windows: - a lot of directories cannot be modified by a regular user; those include the top-level directory of your system partition (usually C: ) and all important directories such as /Windows, /Windows/system32, and /Program Files. - as Michel said, you need an administrator account AND an app "running as administrator" so get over those restrictions. What should work though is access to a number of special folders intended to hold your app's settings and local data, and other things like that. Have a look at Environment.GetFolderPath() and Environment.SpecialFolder Within such directories, one usually creates a hierarchy of folders, so a typical sequence would be:
string fileSpec=Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)+
@"\\companyName\\appName\\logfile.txt";
string folder=Path.GetDirectoryName(fileSpec);
Directory.CreateDirectory(folder); // no need to test existence first!
StreamWriter writer=File.CreateText(fileSpec);
...
:)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.