I just recently started experiencing with ASP.net by using the MVC pattern.
What im trying to do is create a login form with users from a Local phpmyadmin database, now my problem is that when im trying to open the MySqlConnection _mscCon.Open(); it gives me an error:
System.TypeInitializationException: 'The type initializer for 'MySql.Data.MySqlClient.Replication.ReplicationManager' threw an exception.'
FileNotFoundException: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Now im not understanding what this error means and how i am able to fix it, i tried changing the port of my WAMPSERVER and the port of my ASP.NET Localhost and this doesnt seem to work.
private MySqlConnection _mscCon = new MySqlConnection("Server=localhost;Port=3306;Database=asptest;Uid=root;Pwd=;");
public bool CheckCredentials(string username, string password)
{
_mscCon.Open();
if (_mscCon.State == ConnectionState.Open)
{
MySqlCommand mscCommand = new MySqlCommand("SELECT ID FROM users WHERE Username = " + username + " AND Password = " + password + ";", _mscCon);
using (MySqlDataReader reader = mscCommand.ExecuteReader())
{
if (reader.HasRows)
{
return true;
}
}
}
return false;
}
Does anyone know what i might be missing?