Write this in Web.Config file :
<configuration>
<appSettings>
<add key="ConnectionString" value="server=localhost;uid=sa;pwd=;database=DBPerson" />
</appSettings>
</configuration>
//Here value is Connection String used to connect with database
Now you can access above value in your web page as given below: //Here value is Connection String used to connect with database
using System.Configuration;
string connectionString = ConfigurationSettings.AppSettings["ConnectionString"].ToString();
Note:Similarly you can add multiple KEY which you want as global variable.
No comments:
Post a Comment