ASP.NET OpenWebConfiguration failing

后端 未结 2 1573
眼角桃花
眼角桃花 2021-01-12 06:20

I\'m trying to open the web configuration so I can encrypt/decrypt it but it\'s failing. I\'m doing this on Web Developer 2010 Express on my desktop where I setup a website

相关标签:
2条回答
  • 2021-01-12 06:47

    If you are trying to open the web.config from within the application, you don't need to open it, just use:

    var section = WebConfigurationManager.GetSection("mySection");
    

    Just for you to know, the right parameter is:

    Configuration config = WebConfigurationManager.OpenWebConfiguration("~/");
    

    See: http://msdn.microsoft.com/es-es/library/system.web.configuration.webconfigurationmanager(v=vs.100).aspx

    0 讨论(0)
  • 2021-01-12 06:53

    Run your Visual Studio as Administrator. Cheers! :D

    0 讨论(0)
提交回复
热议问题