articles

Home / DeveloperSection / Articles / what is web.config file in .NET with example.

what is web.config file in .NET with example.

what is web.config file in .NET with example.

Ravi Vishwakarma1121 04-Jul-2021

Web.config file

 In the c# programming develop the many types of application like window application, console application, web application, and etc. web.config file mainly build in web application for website configuration (connection string, URL mapping, and any configuration on website store in web.config file). This web.config file is mainly one copy built in web application file if we want to build the many file then we can build it but not in root folder because in root folder build only one config file , we can build many config file in web application, we must make sub folder and then this config file build in sub folder.

 This web.config file in a xml file means than web.config file extension in .xml, we need not restart the web server, when the settings change in the configuration file, asp.net automatically detect the changes in the configuration file. In this configuration many type of settings store in this file.

 For example

  1. Database connection
  2. Cache settings
  3. Cookie setting
  4. Session settings
  5. Error handling
  6. Security

Example of web.config file

<?xml version='1.0'?>

<!--

  For more information on how to configure your ASP.NET application, please visit

  http://go.microsoft.com/fwlink/?LinkId=169433

  -->


<configuration>

    <system.web>

      <compilation debug='true' targetFramework='4.5' />

      <httpRuntime targetFramework='4.5' />

    </system.web>

</configuration>

How to create web.config file

1. Web.config file already exist in project when we are create the project. In some time doesn’t exits then then goto Solution Explorer, and click the Refresh button automatically create the web.config file, if already exits then update the setting

2. In solution explorer right click on project name and add new item

3. In the template window click the web configuration file

4. And click the Add to create the file and open for editing



Hi, my self Ravi Vishwakarma. I have completed my studies at SPICBB Varanasi. now I completed MCA with 76% form Veer Bahadur Singh Purvanchal University Jaunpur. SWE @ MindStick | Software Engineer | Web Developer | .Net Developer | Web Developer | Backend Engineer | .NET Core Developer

Leave Comment

Comments

Liked By