For ASP.NET 2.0 applications, you should store connection strings in the <connectionStrings> section of your application's Web.config file. The connection string used with Windows authentication must include either the Trusted_Connection=Yes attribute, or the equivalent attribute Integrated Security=SSPI, as shown here.
<connectionStrings>
<add name="MyDbConn1"
connectionString="Server=MyServer;Database=MyDb;Trusted_Connection=Yes;"/>
<add name="MyDbConn2"
connectionString="Initial Catalog=MyDb;Data Source=MyServer;Integrated Security=SSPI;"/>
</connectionStrings>
The above two strings are equivalent and both result in Windows authentication to the database.
If you are using data binding expressions in your Web pages, use the ConnectionStrings: qualifier in an ASP.NET expression to use a connection string stored in your application's Web.config file as shown here.
<asp:SqlDataSource ID="SqlDataSource1" Runat="server"
ConnectionString="<%$ ConnectionStrings:MyDbConn1%>">
...
</asp:SqlDataSource>
To access a connection string in code, use ConfigurationManager.ConnectionStrings as shown here.
string connStr = ConfigurationManager.ConnectionStrings["MyDbConn1"].ToString();
SqlConnection conn = new SqlConnection(connStr);
refer
http://msdn.microsoft.com/en-us/library/ff647396.aspx
http://www.asp.net/mvc/tutorials/authenticating-users-with-forms-authentication-cs