Please tell me how can i define connection string in my class file.i do not want to describe it in web.config for Database Security.
//SqlConnection mainConnectionString = new SqlConnection();
string str = "server=192.1.1.1;database=db;user id=sa;password=.com;";
SqlConnection mainConnectionString = new SqlConnection(str);
// mainConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
// mainConnectionString.ConnectionString=("server=192.1.1.1;database=db;user id=sa;password=.com;").ToString();
string sam =Convert.ToString( mainConnectionString);
i use all this thing but project not working but if use
// mainConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
ConnectionString from web.config
then its working fine.
please tell me how i solve this problem or any alternative to secure dB USER and password.
or any decrypt or encrypt method use for web.config.