Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Forms Authentication, Membership.Username case is wrong

Reply
Thread Tools

Forms Authentication, Membership.Username case is wrong

 
 
Tim_Mac
Guest
Posts: n/a
 
      10-21-2008
hi,
i have a minor problem where some users log in with capital letters
for their username, which looks bad when displayed on screen and also
causes discrepancies in some user activity logs maintained in the
database, e.g. "JOE BLOGGS Login" and "Joe Bloggs Login". in an
attempt to standardise the username case, this code used to work fine:

protected void Login1_LoggedIn(object sender, EventArgs e)
{
// find the Membership User
MembershipUser u = Membership.GetUser(this.Login1.UserName);
if(u == null)
throw new Exception("Could not locate user account for " +
this.Login1.UserName);

// use the correct username case (from the aspnetdb database) for the
login cookie
FormsAuthentication.SetAuthCookie(u.UserName, true);
}

but there seems to be a behaviour change since asp.net 3.5, this code
no longer works as expected, Membership.Username now returns the same
case as was submitted by the user, so the Username property is
actually not coming from the database at all. surely this can't be
'by design'?? can anyone confirm if this is a bug, and/or suggest a
workaround?
many thanks
tim
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
lower case to upper case Janice C Programming 17 12-14-2004 02:35 PM
how to case select with case-insensitive string ? Tee ASP .Net 3 06-23-2004 07:40 PM
Possible to turn on/off cookieless sessions dynamically on a case by case basis at run-time? Steve Franks ASP .Net 2 06-10-2004 02:04 PM
Scorsese Collection: Keep case vs Snap case Ray DVD Video 0 05-30-2004 04:04 AM



Advertisments