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 assemblies.
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:
Answer
Ok.. it worked after restarting the VSTS. The link suggested the solution for the same problem. Wish i could have seen it before. :)
No comments:
Post a Comment