title: how can change asp.net web config appsettion key value and resolve the issue of login session end
body: <p>I have code in my project which is changing a value of an appsetting key value</p>
  
  <pre><code>string session = Session["emailid"].ToString();
  string Value = ConfigurationManager.AppSettings["UserNameId"].ToString();
  string intValue = Value;
  Configuration config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath);
  config.AppSettings.Settings.Remove("UserNameId");
  int Chagege = Convert.ToInt32(intValue);
  Chagege++;
  config.AppSettings.Settings.Add("UserNameId", Chagege.ToString());
  config.Save();
  Session["emailid"] = session.ToString();
  </code></pre>
  
  <p>The code is working well there is an a issue on session end where we are rewriting the web.config file and change the key value. How can i can keep the session during with the changed value in the web.config? Any one have a any Idea how can i fix this issue?</p>