Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

Closed Issue: "i" "I" character problem at SimpleMembershipProvider.cs [714]

$
0
0
in Turkish,
we have "i" and "ı" characters. (...h,ı,i,j,k,l,m,...)
"i" is lower, "İ" is upper of "i",
"ı" is lower, "I" is upper of "ı".

When we use membership at MVC4, if "UserName" is includes "i" character, we see this error "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator.".

I looked code at GetUserId(...) at http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/ac69f85f94aa#src/WebMatrix.WebData/SimpleMembershipProvider.cs and I saw "userName.ToUpperInvariant()".

CreateUserAndAccount(...) is create a record at table, if UserName includes "i", it records "i" directly "i", then call GetUserId(...) but GetUserId tries to find "I" character because of "userName.ToUpperInvariant()" and it doesn't find record.

we are talking this at http://forums.asp.net/p/1862233/5240665.aspx/1?Re+How+can+i+use+email+address+for+username+in+MVC4+Membership ,may be this forum page is more help to understand.


internal static int GetUserId(IDatabase db, string userTableName, string userNameColumn, string userIdColumn, string userName)
{
var result = db.QueryValue(@"SELECT " + userIdColumn + " FROM " + userTableName + " WHERE (UPPER(" + userNameColumn + ") = @0)", userName.ToUpperInvariant());
if (result != null)
{
return (int)result;
}
return -1;
}




Comments: Verified in nightly build

Viewing all articles
Browse latest Browse all 7925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>