0

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?

0

1 Answer 1

0

This issue may be resolved if you install MySQL Connector/NET (choose your version)

https://dev.mysql.com/downloads/connector/net/8.0.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.