public string PostBackProc(string data, [AllowNull] string user, int userRights) { NameValueCollection parts = HttpUtility.ParseQueryString(data); string form = parts["id"]; ///// /// /// PluginConfig config = this.pluginConfig; string action = parts["id"]; if (NameToIdWithPrefix(SaveButtonName) == action) { try { PopulatePluginConfig(config, parts); config.FireConfigChanged(); this.divToUpdate.Add(SuccessDivId, "Settings updated successfully"); } catch (Exception e) { pluginInstance.LogError(string.Format("Error updating settings: {0}", e.Message)); this.divToUpdate.Add(ErrorDivId, "Error updating settings"); } } else if (NameToIdWithPrefix(TestButtonName) == action) { PluginConfig testConfig; using (testConfig = new PluginConfig(HS, true)) { PopulatePluginConfig(testConfig, parts); ConnectionTestResults results = ElasticsearchManager.PerformConnectivityTest(testConfig); if (results.ConnectionSuccessful) { StringBuilder stb = new StringBuilder(); stb.Append(@"<div>"); stb.Append(@"<h3>Connection Test Successful!<h3>"); stb.Append(BuildClusterHealthView(results.ClusterHealth)); stb.Append(@"</div>"); this.divToUpdate.Add(SuccessDivId, stb.ToString()); this.divToUpdate.Add(ErrorDivId, ""); } else { string message = "Connection test failed"; if (results.ClusterHealth != null && results.ClusterHealth.OriginalException != null) { message += ": " + results.ClusterHealth.OriginalException.Message; } this.divToUpdate.Add(SuccessDivId, ""); this.divToUpdate.Add(ErrorDivId, message); } } } return(base.postBackProc(Name, data, user, userRights)); }