Gurjeet Singh

Gurjeet Singh

  • NA
  • 90
  • 94.7k

WebConfigurationManager into Class Library

Apr 25 2013 10:19 AM
Dear All,

I am trying to use Web.Configuration into Class Library but i m getting below error even though i already added System.Web dll into class library

Error : Cannot apply indexing with [] to an expression of type 'System.Configuration.ConnectionStringSettingsCollection'

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Web.UI;
using System.Web;
using System.Web.Configuration;
namespace DawarLibrary
{
    class MainClass
    {
        public static string _ConString="";
        static MainClass()
        {
            _ConString = WebConfigurationManager.ConnectionStrings["DawarDB_New"].ConnectionString;
        }    
       



Answers (3)