Filetype association with application (C#)

Regarding file associations, I’ve wrote an answer earlier that at least covers the “How”.

This should also point you to the right direction how to handle backup and restore. With direct registry access through c#, there will be no need to use .reg files, so you are free to back up the previous value however you like in your app, and also restore it from there.

The key question here is: Should you change file associations randomly? At least asking the user up-front would obviously be necessary (as you also indicated).

Furthermore, Vista users with UAC enabled, or non-privileged users of other Windows versions may not have the required permission to change global file associations. The (un)installation procedure of your program may be the only place where this can succeed.

EDIT

As Franci Penov indicated in his answer, there is a way to change local file associations on a per-user basis, even for non-admins (that’s why I spoke of “global associations” in the previous paragraph). He also mentioned mentioned why going there is not overly advisable.

Leave a Comment