Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Leandro Diniz

Editar web.config

Recommended Posts

Estou tentando alterar os valores do web.config utilizando o codigo abaixo, local funciona normal só que quando tento pelo servidor da o seguinte erro;

 

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

 

Parser Error Message: An error occurred loading a configuration file: Access to the path 'C:\inetpub\vhosts\dominio.com.br\subdomains\sistema\httpdocs\gforr_qu.tmp' is denied.

 

Source Error:

 

[No relevant source lines]

 

Source File: C:\inetpub\vhosts\dominio.com.br\subdomains\sistema\httpdocs\web.config Line: 0

 

 

 


 Configuration webConfig = WebConfigurationManager.OpenWebConfiguration("~");
        ConnectionStringsSection dbConnString = webConfig.ConnectionStrings;

        //Alterando
        dbConnString.ConnectionStrings["conn"].ConnectionString = "Data Source=00000000000000;Database=0000000000000;User ID=00000000000;Password=000000000000; pooling=false;";

        webConfig.Save();

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.