What is the AppSetting Section in Web.config file?

What is the AppSetting Section in Web.config file ?



Web.Config file defines configuration for a web project.AppSetting is used to set the user defined values.

For Example:-
You can store the connectionstring.its used to through out the project for database connection.


<>
< key="ConnectionString" value="Provider=Providername;server=servername;uid=userid;pwd=password;database=databasename;">
< /appSettings >



In code behind you get the connection string like this

C#:-

string strConnection = ConfigurationSettings.AppSettings["ConnectionString"];

VB.Net:-

Dim strconn As String = ConfigurationManager.AppSettings("ConnectionString")

No comments:

Post a Comment

Plz Share your comments...