protected void Button1_Click(object sender, EventArgs e)
{
    // Naten cesty k souboru pro aktuln webov poadavek
    string webPath = Request.ApplicationPath;
    
    // Odstrann zatenho zptnho lomtka
    webPath = webPath.Substring(0, webPath.LastIndexOf('/'));

    // Naten konfiguranho objektu pro aktuln webov poadavek
    Configuration config =
    System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(webPath);

    // Vytvoen novho pipojovacho etzce z hodnot textovch pol
    ConnectionStringSettings newConnSetting = new 
    ConnectionStringSettings(txtName.Text, txtValue.Text, txtProvider.Text);

    try
    {
        // Pidn pipojovacho etzce do kolekce
        config.ConnectionStrings.ConnectionStrings.Add(newConnSetting);
        
        // Uloen zmn
        config.Save();
    }
    catch (ConfigurationErrorsException cEx)
    {
        lblStatus.Text = "Vsledek: " + cEx.ToString();
    }
    catch (System.UnauthorizedAccessException uEx)
    {
        // et pro proces ASP.NET mus mt pro adres oprvnn pro ten i zpis.
        lblStatus.Text = "Vsledek: " + "et pro proces ASP.NET mus mt pro adres " + 
           "oprvnn pro ten i zpis.";
    }
    catch (Exception eEx)
    {
        lblStatus.Text = "Vsledek: " + eEx.ToString();
    }

    // Optovn naten pipojovacch etzc do seznamu
    ShowConnectionStrings();
}
