• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C#: How do I avoid the UAC Prompt?

lozina

Lifer
Well first let me just say I am a Windows XP user and I have no experience using Vista or Windows 7. I really do not understand their file protection schemes.

But I have a project I am developing which people download and it needs to save certain things to file, which the program should then be able to load anytime it is run again.

this has always worked fine until users with the newer OS's started reporting problems accessing that file on their system. First it would crash the PC, and then with some research I use this path:
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

to store that file.

But while at least it does not crash anymore I do have people reporting that they get a "UAC prompt" and i guess this is some kind of nag, at least it is nagging to them. So I would like to know how can I store my file while avoiding this nonsense?

What system property would provide me a "safe" path to work with?
 
You are probably writing the file in a location that requires admin privileges. Stick the file somewhere else (like documents and settings)
 
You should give some more information. You imply that people download an app, but what's that mean? Is it a Silverlight app? A WPF click-once install? A downloaded Winforms applications? These all have different rules regarding what happens when they try to write the local disk.
 
You should give some more information. You imply that people download an app, but what's that mean? Is it a Silverlight app? A WPF click-once install? A downloaded Winforms applications? These all have different rules regarding what happens when they try to write the local disk.

lol - I totally forgot to mention that

It is a Windows Forms client side app. An EXE.

IsolatedFileStorage - I read something about this. I guess I will try this as a last resort since it would make things more complicated. I would prefer if I could just get a safe path to work with so I dont have to modify all my code too much with reading.writing to the isolatedfilestorage
 
Are you trying to use the root of ApplicationData or making a subfolder in there? Try a subfolder if you're not doing that right now.
 
I know this is old thread, I have the similar issue. Did anyone resolved the UAC prompt issue for a .Net EXE file to run without UAC prompt
 
I know this is old thread, I have the similar issue. Did anyone resolved the UAC prompt issue for a .Net EXE file to run without UAC prompt

It's better to start a new thread unless it is really the same issue of needing to write to protected folders.

To run a .Net EXE without a UAC prompt, you need to set your project to not require administrator rights. Then you will only see either a UAC prompt or error when you try to access a resource that requires those rights.
 
Back
Top