Where to put the app.config file in Windows 7-VBForums
Results 1 to 3 of 3

Thread: Where to put the app.config file in Windows 7

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,543

    Where to put the app.config file in Windows 7

    Hi!

    We are currntly lifting an old Win XP application to Windows 7. In the old app, the app.config files are placed in program files folder, but due to the policies in Window s7, that is no longer an option. I have read the documentation, and it seems as if Microsoft want us to put the config file under c:\users\[user]\Appdata\myapp\myconfig file

    The users must be able to edit the file frequently, BUT I don't want it to be unique to each logge din user, since this is a shared workstation they run the app under, the config file must be shared between all users, but they log in with their own user name.

    I have not found a satisfactory answer as to where I put the config file? There is "c:\users\All users" folder, but this seems to be a junciton for backwards compatibility, and points to c:\programdata. Is this the folder to use? what is the %% variable for that path?

    Kind regards
    Henrik

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,042

    Re: Where to put the app.config file in Windows 7

    What you want is the CommonAppData folder.

    I'm not sure what the %% name is, but you should at least get a hint from the Microsoft link in the article Where should I store the files that my program uses/creates? from our Classic VB FAQs (in the FAQ forum)

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    11,051

    Re: Where to put the app.config file in Windows 7

    CommonAppData would be the place to create an application subfolder for the application, but like Program Files this isn't a place for users to manipulate data.

    If the "settings editing" is done via the application it's fine, otherwise you might consider somewhere else such as CommonDocuments for user "hand edited" files. In general anything a user opens via Explorer file association is considered a "document."

    However in both cases if you want files created there to be read/write for everyone rather than having "owner" security (others can read, only creator can write) your installer should be creating the subfolder and changing its security settings:
    Any user can write into the All Users\Documents location.

    By default, only the creator of the document (and administrators) will be able to subsequently modify the document. All other (non-admin) Users will have read-only access to the document by default. If an application requires that all normal Users to have write access to a given application specific subdirectory of CSIDL_COMMON_DOCUMENTS, then the application must explicitly modify the security on that sub-directory during application setup.
    Application Specification for Microsoft Windows 2000 for Desktop Applications
    Chapter 4: Data and Settings Management


    As the title of this specifications document suggests, these things are not new for Windows 7 but date back quite a long way. And your concern (proper folder security is now enforced) dates back to 2006 and Vista.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.