2
Reply

mysql and c# winform app problem

Trifon Dinev

Trifon Dinev

Jul 14 2009 4:08 AM
7.9k

Hi all,
I use MySqlMembershipProvider and MySqlRoleProvider from Codeproject for my project. Before this I created a test project:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Web;
using
System.Web.Security;
using
System.Configuration.Provider;
using
System.Collections.Specialized;
using
System.Data;
using
System.Collections;
using
System.Configuration;
using
System.Diagnostics;
using
System.Globalization;
using
System.Security.Cryptography;
using
System.Web.Configuration;
using
System.Reflection;
using
System.Text.RegularExpressions;
using
MySql.Data.MySqlClient;
namespace
vusers
{
class Program
{
static void Main(string[] args)
{
mmi.
MySqlMembershipProvider m = new mmi.MySqlMembershipProvider();
MembershipCreateStatus status = default(MembershipCreateStatus);

m.CreateUser(
"aa", "aaaaaa1!", [email protected], "beast", "Roni", true, null, out status);
Console.WriteLine(status.ToString());
if (m.ValidateUser("aa", "aaaaaa1!"))
Console.WriteLine("You are authorized!");
else{
Console.WriteLine("Not such user!");
Console.ReadLine();
}

}
}
}
My app.confog is:
<?
xml version="1.0" encoding="utf-8" ?>
<!--

Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config

-->
<
configuration>

<
connectionStrings>
<
remove name="ConnString"/>
<
add name="ConnString" connectionString="Database=sof_mmi;Data Source=localhost; User Id=mmi;Password=qwe123; providerName=MySql.Data.MySqlClient"/>
</
connectionStrings>

<
system.data>
<
roleManager enabled="true" defaultProvider="MySQLRoleProvider">
<
providers>
<
add connectionStringName="ConnString" applicationName="Balkantel" name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, Version=6.0.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
</
providers>
</
roleManager>
<
membership defaultProvider="MySQLMembershipProvider">
<
providers>
<
add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="3" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" autogenerateschema="true"/>
</
providers>
</
membership>
<
profile defaultProvider="MySQLProfileProvider">
<
providers>
<
add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web,Version=6.0.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" connectionStringName="ConnString" applicationName="/" />
</
providers>
</
profile>
</
system.data>

</
configuration>
the problem is that I recieve:
ProviderError
Not such user!

Could you, please tell me where am I wrong with my code?
Thanks and regards,
Trifon.

Answers (2)