Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

.NET 2.0 and System.Configuration.ApplicationSettingsBase

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
delfinon@libero.it - 05 Jul 2006 13:25 GMT
Hi all,
I think that ApplicationSettingsBase class on .NET 2.0 framework is
very useful and easy to use, in order to store global and personal
paramenters for a winform application.

The only behaviour that I don't like is where it saves updated user
settings.

AFAIK it saves a file called:

<document and settings folder>\<userfolder>\Local Settings\Application
Data\<companyname>\<applicationname>_StrongName_n5qhp1elc4gnqe1a1bida0iqjryk1mun\<applicationversion>\user.config

Anyone knows hot to customize/change this default location/name?

I would like to have something without the "strong name" part, like:

<document and settings folder>\<userfolder>\Local Settings\Application
Data\<companyname>\<applicationname>\<applicationversion>\user.config

thank you in advance for your help.
N
Stoitcho Goutsev (100) - 05 Jul 2006 14:36 GMT
Hi,

In order to do that you need to implement your own SettingsProvider. By
default ApplicationSettingsBase uses LocalFileSettingsProvider.

You can start of inheriting from LocalFileSettingsProvider and overriding
SetPropertyValues method. This is the method that saves the settings. I'd
suggest to look with the Reflector in the System.Configuration.dll assembly
to see how this method is implemented. Unfortunatelly it uses internal class
of getting the folder where the user settings are stored, but you can get an
idea of how to implement this method.

Signature

HTH
Stoitcho Goutsev (100)

--
Stoitcho Goutsev (100)

> Hi all,
> I think that ApplicationSettingsBase class on .NET 2.0 framework is
[quoted text clipped - 18 lines]
> thank you in advance for your help.
> N
William Sullivan - 05 Jul 2006 21:25 GMT
Why are you thinking about doing this?  You might mess up compatability with
new builds if you change this.  Besides, your users shouldn't be modifying
this themselves, so does it matter how ugly the path is?  Just wondering...

> Hi all,
> I think that ApplicationSettingsBase class on .NET 2.0 framework is
[quoted text clipped - 18 lines]
> thank you in advance for your help.
> N
delfinon@libero.it - 07 Jul 2006 10:44 GMT
The main reason is that I have also other "private" configuration files
that I want to keep in the same place/folder. Is there any way to
obtain this full path so that I can use also for my other stuff?
G

William Sullivan ha scritto:

> Why are you thinking about doing this?  You might mess up compatability with
> new builds if you change this.  Besides, your users shouldn't be modifying
[quoted text clipped - 22 lines]
> > thank you in advance for your help.
> > N
William Sullivan - 07 Jul 2006 13:39 GMT
A couple suggestions...
I believe that this config file is designed to be flexible; if you add
additional content to the config, it will not break.  This is how the
Patterns and Practices group add their block configuration to an
application--they add their config sections to the program's manifest.  
If you are needing to keep information in a separate location so that it can
be used across versions, I would suggest that rather than changing the
program's manifest location, create a new directory to contian your
configuration data.  This should be under the user's Application Data folder
(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)).  
Create a subfolder in this directory for your app data and store it.  This
location will also roam with the user if the machine is on a domain.  

> The main reason is that I have also other "private" configuration files
> that I want to keep in the same place/folder. Is there any way to
[quoted text clipped - 29 lines]
> > > thank you in advance for your help.
> > > N
delfinon@libero.it - 12 Jul 2006 14:06 GMT
Thank you for your note, William. I'll add all xml serializable stuff
in the standard config file. But I have also some "binary format"
configuration file I can't put there. Agaiin is there any "supported"
way to obtain at runtime the full path/folder used by configuration
component?
N

William Sullivan ha scritto:

> A couple suggestions...
> I believe that this config file is designed to be flexible; if you add
[quoted text clipped - 42 lines]
> > > > thank you in advance for your help.
> > > > N

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.