What is the difference between Web.config and Machine.Config in .NET?

Web.config file is used to make the settings to a web application, whereas Machine.config file is used to make settings to all ASP.NET applications on a server(the server machine).

Can connection strings be stored in web.config?

Yes, in fact this is the best place to store the connection string information.

What is the difference between web.config and app.config?

Web.config is used for web based asp.net applications whereas app.config is used for windows based applications.

What are the different modes for the sessionstates in the web.config file?

Off: Indicates that session state is not enabled.
Inproc: Indicates that session state is stored locally.
StateServer: Indicates that session state is stored on a remote server.
SQLServer: Indicates that session state is stored on the SQL Server.

Explain Web.config Settings for exception management in ASP.NET.

You should configure exception management settings within your application’s Web.config file. The following is an example of the exception settings in a Web.config file.

< customErrors defaultredirect=”http://hostname/error.aspx” mode=”On”/>
< error statuscode=”500″ redirect=”/errorpages/servererror.aspx” />
< error statuscode=”404″ redirect=”/errorpages/filenotfound.htm” />
< /customErrors>

In the customErrors element, specify a default redirect page. There are three modes for the default redirect page:

On
Unhandled exceptions will redirect the user to the specified defaultredirect page. This is used mainly in production.

Off
Users will see the exception information and not be redirected to the defaultredirect page. This is used mainly in development.

RemoteOnly
Only users accessing the site on the local machine (using localhost) will see the exception information while all other users will be redirected to the defaultredirect page. This is used mainly for debugging.
In addition to the default redirect page, you can set specific pages for certain HTTP error codes. For example, you can specify that all 404 errors result in a certain error page, while all 500 errors result in another

What are the two types of configuration files supported by ASP.Net?

Machine.Config:
This is automatically installed when you install Visual Studio. Net.
This is also called machine level configuration file.
Only one machine.config file exists on a server.
This file is at the highest level in the configuration hierarchy.
Web.Config:
This is automatically created when you create an ASP.Net web application project.
This is also called application level configuration file.
This file inherits setting from the machine.config

What is AppSetting Section in “Web.config” file?

Web.config file defines configuration for a web project. Using “AppSetting” section we can define user-defined values.