Writing to app.config

R

ryanbreakspear

Hi, I've spent some time looking at articles about this but I can't
get it to work. I'm trying to write to my app.config file in .Net 2.0
using:

Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["email"].Value = "(e-mail address removed)";
config.Save(ConfigurationSaveMode.Minimal, true);

I get the message "Attempting to perform an unauthorized operation".
This is going to be a single user application with full write access
to the executable's path.

Thanks in advance.

Ryan
 
R

ryanbreakspear

Hi, I've spent some time looking at articles about this but I can't
get it to work. I'm trying to write to my app.config file in .Net 2.0
using:

Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["email"].Value = "(e-mail address removed)";
config.Save(ConfigurationSaveMode.Minimal, true);

I get the message "Attempting to perform an unauthorized operation".
This is going to be a single user application with full write access
to the executable's path.

Thanks in advance.

Ryan

Interestingly, this works on a local drive. The LocalIntranet Zone
settings are set up to FullTrust, and I can read/write to other files
in the same location from within the application.

Any ideas?

Ryan
 
L

Lasse Vågsæther Karlsen

Hi, I've spent some time looking at articles about this but I can't
get it to work. I'm trying to write to my app.config file in .Net 2.0
using:

Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["email"].Value = "(e-mail address removed)";
config.Save(ConfigurationSaveMode.Minimal, true);

I get the message "Attempting to perform an unauthorized operation".
This is going to be a single user application with full write access
to the executable's path.

Thanks in advance.

Ryan

Why are you trying to do that?
Can't you use user settings instead which will be saved somewhere else?
 
R

ryanbreakspear

Hi, I've spent some time looking at articles about this but I can't
get it to work. I'm trying to write to my app.config file in .Net 2.0
using:
Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["email"].Value = "(e-mail address removed)";
config.Save(ConfigurationSaveMode.Minimal, true);
I get the message "Attempting to perform an unauthorized operation".
This is going to be a single user application with full write access
to the executable's path.
Thanks in advance.

Why are you trying to do that?
Can't you use user settings instead which will be saved somewhere else?

--
Lasse Vågsæther Karlsen
mailto:[email protected]://presentationmode.blogspot.com/- Hide quotedtext -

- Show quoted text -

Because I want all the configuration settings in one place, and the
settings aren't specific to a user.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top