Web config plays vital role in web development. It actually stores all the configurations so that it can well handled and used repeatedly all over the application without repeatation.
It actually stores values for database connection,Session states,Error Handling and security and these can be handled as developer wants to and wish to show the proper messages to user.
Depending upon the web config file whole application works.
web.config can appear in any directory on an ASP.NET Web application server. Each web.config file applies configuration settings to the directory it is located in and to all virtual child directories beneath it. Settings in child directories can optionally override or modify settings specified in parent directories. ASP.NET configures IIS to prevent direct browser access to web.config files to ensure that their values cannot become public (attempts to access them will cause ASP.NET to return 403: Access Forbidden). At run time ASP.NET uses these web.config configuration files to hierarchically compute a unique collection of settings for each incoming URL target request (these settings are calculated only once and then cached across subsequent requests; ASP.NET automatically watches for file changes and will invalidate the cache if any of the configuration files change).