I am trying to access connectionstrings from the config file. The code is ASP.NET + C#. I have added System.Configuration to reference and also mentioned with using. But, still it wouldn't accept the assembly.
I am using VSTS 2008. Any idea what could be the reason? Another weird thing is the assembly name shown as "System.configuration", a lower case c which is not how names are displayed for other System assembleis.
Thanks!
ADDED CODE:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Utility
{
public class CommonVariables
{
public static String ConnectionString
{
get { return ConfigurationManager.ConnectionStrings["EmployeeEntities"].ConnectionString; }
}
}
}
Config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="qbankEntities" connectionString="metadata=res://*/qbankModel.csdl|res://*/qbankModel.ssdl|res://*/qbankModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=localhost;Initial Catalog=qbank;Persist Security Info=True;User ID=**;Password=****;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>