public string Index(TestResultModel res)
        {
            bool validData = validatePost(ref res);
            if (validData)
            {
                speedtest_common.Repositories.TestRepository repo = new speedtest_common.Repositories.TestRepository(speedtest_common.dbConfig.create(ConfigurationManager.ConnectionStrings["speedtest_logger.Properties.Settings.logConnectionString"].ConnectionString));
                repo.create(res.databaseObject);
            }

            return "ok";// Don't reveal if validation was a success
        }
 private bool validatePost(ref TestResultModel res)
 {
     StringBuilder hashCheck = new StringBuilder();
     hashCheck.Append(res.ping);
     hashCheck.Append("-");
     hashCheck.Append(res.upload);
     hashCheck.Append("-");
     hashCheck.Append(res.download);
     hashCheck.Append("-");
     hashCheck.Append(ConfigurationManager.ConnectionStrings["speedtest_logger.Properties.Settings.postPassword"].ConnectionString);
     bool validation= false;
     using (MD5 md5Hash = MD5.Create())
     {
         string hash = GetMd5Hash(md5Hash, hashCheck.ToString());
         if (hash == res.hash) validation = true;
     }
     return validation;
 }