I have added a key/value to AppSettings to hold an integer value that will increment when a function is called. In my global.asaxon application start I want to call a function to populate my appsetting key with an initial value.
When I try loading the app I'm getting an access denied error on a .tmp file.
The code that's called from my Global.asax is as follows:-
My web.config is like this:-Code:public static void GetEvalNo() { Configuration config = WebConfigurationManager.OpenWebConfiguration("~/"); //config.AppSettings.Settings["EvalNo"].Value = "Got Here"; //config.Save(ConfigurationSaveMode.Modified); //return; //KeyValueConfigurationElement appValue = config.AppSettings.Settings["EvalNo"]; int evalNo = GlobalDAL.GetEvalNo(); try { config.AppSettings.Settings["EvalNo"].Value = evalNo++.ToString(); config.Save(ConfigurationSaveMode.Modified); //return evalNo++.ToString(); } catch (Exception ex) { //appValue.Value = ex.ToString(); } }
I thought it should be possible to update this value. Any ideas?Code:<appSettings> <add key="EvalNo" value="" /> </appSettings>



LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks