Try this,
C#
SqlConnection cnn = new SqlConnection();
string sqlcon = System.Configuration.ConfigurationManager.AppSettings["connString"];
cnn = new SqlConnection(sqlcon);
cnn.Open();
SqlCommand cmd = new SqlCommand("select mobileno, password from register where mobileno='" + txtmobile.Text + "'and password='" + txtpassword.Text + "'", cnn);
cmd.Connection = cnn;
SqlDataReader dr = cmd.ExecuteReader();
web.config
<appsettings>
<add key="connString" value="server=midas Host;database=kandivalideal;" />
</appsettings>