Home > ASP.NET 2.0, C# > Get data from web.config

Get data from web.config

Thursday, 24 April, 2008 Leave a comment Go to comments

Any data
<?xml version="1.0"?>
<add key="admins" value="esetov_b, lobanov_v"/>

string admins = ConfigurationManager.AppSettings["Admins"];

Connection String
<?xml version="1.0"?>
<add name="ASPGConnectionString" connectionString="Data Source=DS;Initial Catalog=basename;Persist Security Info=True;User ID=user;Password=psw"
providerName="System.Data.SqlClient" />

SqlConnection conn = new

  1. baurdotnet
    Friday, 23 May, 2008 at 10:31 am

    using sample:
    void AdminMode(string currentuser)
    string admins = ConfigurationManager.AppSettings["Admins"];
    admins = admins.ToUpper();
    currentuser = currentuser.ToUpper();
    int index = admins.IndexOf(@currentuser);
    if (index != -1)
    //admin settings
    } else

  2. Soubhik
    Saturday, 6 August, 2011 at 6:26 am

    It’s helpful.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: