constring = (string)ConfigurationManager..
.ConnectionStrings["connstr"].ConnectionString;

where
connstr is the connectionstring name in web.config