Hello, I from the code behind I need to update my web.config. This has never been a problem before, however I am getting an error recently. The errors say "Failed to map the path '/'." The lines commented out were different variations of what i tried.
//Configuration myWebConfig = WebConfigurationManager.OpenWebConfiguration(Server.MapPath("~"));
//Configuration myWebConfig = WebConfigurationManager.OpenWebConfiguration("~");
//Configuration myWebConfig = WebConfigurationManager.OpenWebConfiguration(null);
Configuration myWebConfig = WebConfigurationManager.OpenWebConfiguration(".");
// update pages theme
RoleManagerSection section = (RoleManagerSection)myWebConfig.GetSection("system.web/roleManager");
section.DefaultProvider = "SqlRoleManager";
section.Providers.Clear();
ProviderSettings providerSettings = new ProviderSettings();
providerSettings.Name = "SqlRoleManager";
providerSettings.Type = "System.Web.Security.SqlRoleProvider";
providerSettings.Parameters.Clear();
providerSettings.Parameters.Add("connectionStringName", "SimpleTickConnection");
providerSettings.Parameters.Add("applicationName", "TheaterSales");
section.Providers.Add(providerSettings);
myWebConfig.Save();