I need to get the instance of current configuration in my web application. I found that I can get it in the following way:
Configuration configuration = WebConfigurationManager.OpenWebConfiguration( HttpContext.Current.Request.ApplicationPath);
But in some parts of my project I have no HttpContext so I need to get the instance of the config without using the HttpContext.
you right Lubochkn ~ does the trick...
_webConfigurationManager = WebConfigurationManager.OpenWebConfiguration("~");
You should be able to get the web.config
like this too:
Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With