When is web.config called?
-
I am not very sure of the exact answer. So, I am posting it to find the correct answer. But i guess Web.config is an xml configuration file. This never gets called directly unless we need to retrieve the configuration setting. I am not dam sure but i think this should happen.
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi
-
I am not very sure of the exact answer. So, I am posting it to find the correct answer. But i guess Web.config is an xml configuration file. This never gets called directly unless we need to retrieve the configuration setting. I am not dam sure but i think this should happen.
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi
Well...yes and no. It doesn't just hold your own configuration settings, it holds settings for the application so the file will automatically be read every time the application/application pool is restarted and is read into memory. Because of this, every time you change the web.config, the app will do a re-pre-compile to reread it into memory. So by rights, in ordinary use, it's only really called when the application is started. That being said, I've had to write custom web.config readers for specific projects but that's my custom code reading the physical file, not the normal operating procedure for the overall project.
-
Well...yes and no. It doesn't just hold your own configuration settings, it holds settings for the application so the file will automatically be read every time the application/application pool is restarted and is read into memory. Because of this, every time you change the web.config, the app will do a re-pre-compile to reread it into memory. So by rights, in ordinary use, it's only really called when the application is started. That being said, I've had to write custom web.config readers for specific projects but that's my custom code reading the physical file, not the normal operating procedure for the overall project.
Thanks for your reply but i have one query so pls correct me if i m wrong This is how the minimal Web.config file should look like: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> </system.web> </configuration> I do agree that Web.config file is a perfect place to store ASP.NET application configuration settings but if i have above web.config then my other configuration must be in machine.config then how cum web.config called when application pool restarted. I may be wrong but pls give your glance and guide me ...
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi
-
Thanks for your reply but i have one query so pls correct me if i m wrong This is how the minimal Web.config file should look like: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> </system.web> </configuration> I do agree that Web.config file is a perfect place to store ASP.NET application configuration settings but if i have above web.config then my other configuration must be in machine.config then how cum web.config called when application pool restarted. I may be wrong but pls give your glance and guide me ...
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi
Because as far as I know, you cannot stop a web application from checking web.config. Just because it's empty is no reason for it not to still read it into memory. This is inbuilt behaviour as far as I know. I also wouldn't use machine.config to hold settings for you. If you are concerned about security, you can encrypt sections of the web.config and the .NET service will decrypt it automatically for you so you don't even need to chagne your code.
-
Because as far as I know, you cannot stop a web application from checking web.config. Just because it's empty is no reason for it not to still read it into memory. This is inbuilt behaviour as far as I know. I also wouldn't use machine.config to hold settings for you. If you are concerned about security, you can encrypt sections of the web.config and the .NET service will decrypt it automatically for you so you don't even need to chagne your code.
ohhkkk Thanks for your reply now i am clear with my question actually i was confused just because of machine.config. Thanks once again for your reply.
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi
-
Thanks for your reply but i have one query so pls correct me if i m wrong This is how the minimal Web.config file should look like: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> </system.web> </configuration> I do agree that Web.config file is a perfect place to store ASP.NET application configuration settings but if i have above web.config then my other configuration must be in machine.config then how cum web.config called when application pool restarted. I may be wrong but pls give your glance and guide me ...
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi
http://msdn.microsoft.com/en-us/library/aa719558(VS.71).aspx[^] Multiple configuration files, all named Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. Configuration files in child directories can supply configuration information in addition to that inherited from parent directories, and the child directory configuration settings can override or modify settings defined in parent directories. The root configuration file named systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Machine.config provides ASP.NET configuration settings for the entire Web server.
I know the language. I've read a book. - _Madmatt
-
I am not very sure of the exact answer. So, I am posting it to find the correct answer. But i guess Web.config is an xml configuration file. This never gets called directly unless we need to retrieve the configuration setting. I am not dam sure but i think this should happen.
Reasons are not Important but Results are Important. http://www.sql4professional.blogspot.com Swati Tripathi
My understanding (from reading a WCF book) is that web.config is used by IIS when it runs your application. Your application is basically a plug-in that IIS runs if it has been configured to do so. I would put my own configuration information somewhere else.