Web.confg issue multiple user accessing

Viewed 32

This is causing the issue when multiple user access the web.config file at the same time the error says the file is being used by another process

var config = ConfigurationManager.OpenExeConfiguration(string.Empty);

var section = config.GetSection(configSectionName);

// If the section exists and it is not protected
if (section != null && !section.SectionInformation.IsProtected)
{
    // Get the name of the default provider
       
    var pcs = (ProtectedConfigurationSection)config.GetSection("configProtectedData");
    var provider = pcs.DefaultProvider;

    // Apply the provider to the section and save
                    
    section.SectionInformation.ProtectSection(provider);
    config.Save();
}
0 Answers
Related