I make an application and make setup file using VS setup project. This work fine and create default text files into Program Files Folder for winodw 7/vista .but can not modify these files or create any new files.
There are few text files need to create ,modify during application running ,but in windows 7/vista unable to create,modify files.I am using full default admin right for these OS. If iuse C: root path then application work fine or for win XP no problem.
I think UAC restricting to perform these opeartion. But i do not know how to change these restriction using vb.net, whenever application start.
I found one solution that , if change user rights manually then this problem solved. Follow these step to change your account settings. Control Panel-->User Accounts and Family Safety-->User Accounts-->Change User Account Control settings-->Never notify(Set tab to never notify). After this change need to restart system. Now can make all changes like windows XP into Windows 7.can also make changes into program files.
Its working fine, but need to make these changes manually in OS.
but its not efficent solution.
So if any one knows how can make these changes by coding that will nice.
-
possible duplicate of Does Windows 7 have the same problem as Vista?Cody Gray– Cody Gray ♦2011年07月27日 08:52:14 +00:00Commented Jul 27, 2011 at 8:52
-
2Do not make these changes in code! You need to comply with UAC, not work against it. No Windows application should assume it has write privileges to the Program Files directory. EVER.Cody Gray– Cody Gray ♦2011年07月27日 08:52:48 +00:00Commented Jul 27, 2011 at 8:52
-
yes vista also have the same problemmuhammad hanif– muhammad hanif2011年07月28日 01:21:45 +00:00Commented Jul 28, 2011 at 1:21
-
Yes, but it's not a "problem". It's a solution. Use the Application Data directory designed for this purpose. Apps can't write to system or program directories. Period. Not sure where the question here is other than "I don't like that". Tough. Users didn't like you monkeying around with system files, either.Cody Gray– Cody Gray ♦2011年07月28日 01:28:40 +00:00Commented Jul 28, 2011 at 1:28
1 Answer 1
I seriously doubt whether you can create and delete files under Program Files Folder through code in windows7/vista. Even if there is a way, I would consider doing this a bad design and a security flaw.
If you want to create/modify/delete files during you app execution. you can create them "C:\Users\\AppData\Local\\ and do whatever you want to do over there.
Program Files Folder is not the place for storing temporary data.