Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Application Settings user settings storage directory

Reply
 
Old 04-04-2008   #1 (permalink)
Chris Crowther MBCS


 
 

Application Settings user settings storage directory

Hi All,

I was looking to use user settings to store some, well, user settings,
but right now the directory used to store changes periodically and I
haven't been able to work out what causes it.

It's storing it in a path that follows the pattern:

\Local Settings\Application Data\RHD_Research_Limited\<Application
Name>_Url_?????????\<Version>

Where the "??????" portion is what was changing and is a stream of,
seemingly, random alpha numeric data; I'm guessing it's actually a hash
of some kind.

The form looks a little odd to me; I'm not sure where the Url* portion
is coming from or why the spaces have been changed to underscores.
Normally I'd expect to see the base path look more like

\Local Settings\Application Data\RHD Research Limited\<Application Name>

The version portion I expect to change when the assembly version number
is bumped - as it does - which is fine because that's what
Properties.Settings.Default.Upgrade() is for. Problem is that doesn't
work if the application directory keeps changing as well; it can't find
the old settings to upgrade them, because they're obviously in a
different path - this is the real problem for me.

Anyone have idea what is causing the application name to get mangled the
way it is and - a little more importantly - how I can stop it? If I
can't get it to work properly I'm going to have to fall back to using
registry entries - it is a winforms app - which is no great hardship,
it's just moderately annoying.

--
Chris Crowther MBCS
C# Developer
RHD Research Ltd

My System SpecsSystem Spec
Old 04-07-2008   #2 (permalink)
Steven Cheng [MSFT]


 
 

RE: Application Settings user settings storage directory

Hi Chris,

As for the ApplicationSettings in .NET 2.0(for higher) application, is use
the default "LocalFileSettingsProvider" which will use randomly generated
path (in User's LocalSettings temp dir) to store "User Scope" setting
items. Here are some article which also mentioned some about the file path
of the user scope settings:

#Using My.Settings in Visual Basic 2005
http://msdn2.microsoft.com/en-us/lib...11(VS.80).aspx

#Exploring Secrets of Persistent Application Settings
http://www.devx.com/dotnet/Article/33944/1954

I've also inspected the LocalFileSettingsProvider class, it seems it use a
internal class to generate the temp file path(and will vary between
multiple updates). So far if you need a predictable path for store such
settings, I think you may consider the following options:

1. Use Application Scope instead of User Scope so that the settings will be
stored in App.config file

2. Use custom provider for your application, here is a web article
mentioned creating custom settings provider:

#Creating a Custom Settings Provider
http://www.codeproject.com/KB/vb/Cus...sProvider.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




--------------------
Quote:

>Date: Fri, 04 Apr 2008 12:20:16 +0100
>From: Chris Crowther MBCS <hikari@xxxxxx>
>Organization: RHD Research Ltd
>User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
>MIME-Version: 1.0
>Subject: Application Settings user settings storage directory
Quote:

>
>Hi All,
>
>I was looking to use user settings to store some, well, user settings,
>but right now the directory used to store changes periodically and I
>haven't been able to work out what causes it.
>
>It's storing it in a path that follows the pattern:
>
>\Local Settings\Application Data\RHD_Research_Limited\<Application
>Name>_Url_?????????\<Version>
>
>Where the "??????" portion is what was changing and is a stream of,
>seemingly, random alpha numeric data; I'm guessing it's actually a hash
>of some kind.
>
>The form looks a little odd to me; I'm not sure where the Url* portion
>is coming from or why the spaces have been changed to underscores.
>Normally I'd expect to see the base path look more like
>
>\Local Settings\Application Data\RHD Research Limited\<Application Name>
>
>The version portion I expect to change when the assembly version number
>is bumped - as it does - which is fine because that's what
>Properties.Settings.Default.Upgrade() is for. Problem is that doesn't
>work if the application directory keeps changing as well; it can't find
>the old settings to upgrade them, because they're obviously in a
>different path - this is the real problem for me.
>
>Anyone have idea what is causing the application name to get mangled the
>way it is and - a little more importantly - how I can stop it? If I
>can't get it to work properly I'm going to have to fall back to using
>registry entries - it is a winforms app - which is no great hardship,
>it's just moderately annoying.
>
>--
>Chris Crowther MBCS
>C# Developer
>RHD Research Ltd
>
My System SpecsSystem Spec
Old 04-07-2008   #3 (permalink)
Chris Crowther MBCS


 
 

Re: Application Settings user settings storage directory

Steven Cheng [MSFT] wrote:
Quote:

> As for the ApplicationSettings in .NET 2.0(for higher) application, is use
> the default "LocalFileSettingsProvider" which will use randomly generated
> path (in User's LocalSettings temp dir) to store "User Scope" setting
> items. Here are some article which also mentioned some about the file path
> of the user scope settings:
Looking through http://blogs.msdn.com/rprabhu/articles/433979.aspx,
linked to from the second of those URLs, it seems the url_xxxx portion
of the file path is generated from the AppDomain evidence.

Taking a look at the Evidence info in the MSDN docs and checking the
values during runtime, the Url is the location of the executable file on
the disk, which changes any time we bump the version number.
Quote:

> 1. Use Application Scope instead of User Scope so that the settings will be
> stored in App.config file
The problem with application scope is the settings will be RO - if I
understand it correctly - whereas these values need to be RW.
Quote:

> 2. Use custom provider for your application, here is a web article
> mentioned creating custom settings provider:
I shall take a look at that, thanks.
Quote:

> Steven Cheng
--
Chris Crowther MBCS
C# Developer
RHD Research Ltd
My System SpecsSystem Spec
Old 04-07-2008   #4 (permalink)
Steven Cheng [MSFT]


 
 

Re: Application Settings user settings storage directory

Thanks for your reply Chris,

Yes, currently Application scope items doesn't provide existing means to
edit it. I found someone else provide some custom approach for editing
Application Scope setting items. Here is one posted by a MS engineer:

#Changing application settings programmatically in .NET Framework 2.0
http://blogs.msdn.com/mosharaf/archi...lication-setti
ngs-programmatically-in-net-framework-2-0.aspx

Hope this also helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
Quote:

>Date: Mon, 07 Apr 2008 11:41:17 +0100
>From: Chris Crowther MBCS <hikari@xxxxxx>
>Organization: RHD Research Ltd
>Subject: Re: Application Settings user settings storage directory
Quote:

>
>Steven Cheng [MSFT] wrote:
>
Quote:

>> As for the ApplicationSettings in .NET 2.0(for higher) application, is
use
Quote:
Quote:

>> the default "LocalFileSettingsProvider" which will use randomly
generated
Quote:
Quote:

>> path (in User's LocalSettings temp dir) to store "User Scope" setting
>> items. Here are some article which also mentioned some about the file
path
Quote:
Quote:

>> of the user scope settings:
>
>Looking through http://blogs.msdn.com/rprabhu/articles/433979.aspx,
>linked to from the second of those URLs, it seems the url_xxxx portion
>of the file path is generated from the AppDomain evidence.
>
>Taking a look at the Evidence info in the MSDN docs and checking the
>values during runtime, the Url is the location of the executable file on
>the disk, which changes any time we bump the version number.
>
Quote:

>> 1. Use Application Scope instead of User Scope so that the settings will
be
Quote:
Quote:

>> stored in App.config file
>
>The problem with application scope is the settings will be RO - if I
>understand it correctly - whereas these values need to be RW.
>
Quote:

>> 2. Use custom provider for your application, here is a web article
>> mentioned creating custom settings provider:
>
>I shall take a look at that, thanks.
>
Quote:

>> Steven Cheng
>
>--
>Chris Crowther MBCS
>C# Developer
>RHD Research Ltd
>
My System SpecsSystem Spec
Old 04-09-2008   #5 (permalink)
Chris Crowther MBCS


 
 

Re: Application Settings user settings storage directory

Steven Cheng [MSFT] wrote:
Quote:

> Yes, currently Application scope items doesn't provide existing means to
> edit it. I found someone else provide some custom approach for editing
> Application Scope setting items. Here is one posted by a MS engineer:
I went with the custom settings provider, which seems to be working well
as a solution.

Thanks for the pointers
Quote:

> Steven Cheng
--
Chris Crowther MBCS
C# Developer
RHD Research Ltd
My System SpecsSystem Spec
Old 04-09-2008   #6 (permalink)
Steven Cheng [MSFT]


 
 

Re: Application Settings user settings storage directory

You're welcome

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

--------------------
Quote:

>Date: Wed, 09 Apr 2008 09:20:41 +0100
>From: Chris Crowther MBCS <hikari@xxxxxx>
>Organization: RHD Research Ltd
>User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
>MIME-Version: 1.0
>Subject: Re: Application Settings user settings storage directory
Quote:

>
>Steven Cheng [MSFT] wrote:
>
Quote:

>> Yes, currently Application scope items doesn't provide existing means to
>> edit it. I found someone else provide some custom approach for editing
>> Application Scope setting items. Here is one posted by a MS engineer:
>
>I went with the custom settings provider, which seems to be working well
> as a solution.
>
>Thanks for the pointers
>
Quote:

>> Steven Cheng
>
>--
>Chris Crowther MBCS
>C# Developer
>RHD Research Ltd
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
User Settings Disappearing; Monitor Settings Unstable; Desktop Search Overtakes System; Laptops Unusable Vista General
Where to store user settings in a window application? .NET General
Cannot open Theme Settings, Display Settings, Screen Saver Settings, etc Vista performance & maintenance
Clearing IP settings: duplicate ip settings and blank ip settings Vista networking & sharing
Clearing IP settings: duplicate ip settings and blank ip settings Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46