I have face the problem of connection string which gives me the error as:
Format of the initialization string does not conform to specification starting at index 0.
Pls give me suggestions on this problem.the code which i had written is:
Web.Config:
and
public static string GetconString()
{
return ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
}

Khan Abrar AhmedRank #778 · 3K reputationPosted May 18, 2014, 12:35 AM EDT
try the below connection string in web.config file.
Riddhi ValechaRank #794 · 2.9K reputationPosted Dec 31, 2014, 10:29 PM EST
I have a doubt about Connection String.
In the given method -
public static string GetCOnnectionString();
We get a static string.
My Question is - Should this connection string be static or constant ??
If static, why static and if const, why constant ??
Which is a better approach.
Khargesh RajputRank #616 · 3.9K reputationPosted Dec 31, 2014, 11:49 PM EST
as
configuration> connectionstrings> add name="TestConnectionstring" connectionString="Data Source=.;Initial Catalog=db;Integrated Security=True"/> add>connectionstrings> configuration> and in method GetCOnnectionString() var connectionString=ConfigurationManager.ConnectionStrings["TestConnectionstring"].ConnectionString; returns conectionstrring