title: web.config in asp.net
body: <p>I've got the function for changing the  values in web.config
  but my problem is it is not getting the path of web.config correctly and throwing </p>
  
  <p>"Could not find file 'C:\Users\maxnet25\Web.config'"
  It was giving error on xmlDoc.Load() function.</p>
  
  <p>My code:</p>
  
  <pre><code>    public void UpdateConfigKey(string strKey, string newValue)
      {
          XmlDocument xmlDoc = new XmlDocument();
          xmlDoc.Load(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\Web.config");
          if (!ConfigKeyExists(strKey))
          {
              throw new ArgumentNullException("Key", "&lt;" + strKey + "&gt; not find in the configuration.");
          }
  
          XmlNode appSettingsNode = xmlDoc.SelectSingleNode("configuration/appSettings");
          foreach (XmlNode childNode in appSettingsNode)
          {
              if (childNode.Attributes["key"].Value == strKey)
                  childNode.Attributes["value"].Value = newValue;
          }
          xmlDoc.Save(AppDomain.CurrentDomain.BaseDirectory + "..\\..\\Web.config");
          xmlDoc.Save(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
                   Label1 .Text ="Key Upated Successfullly";            
      }
  </code></pre>