I'm using ASP.NET MVC 1.0 along with the Oracle ASP.NET Membership Providers. I'm running into a case sensitivity problem.
When a user logs into the system, it appears that the Membership provider sets the User.Identity.Name value to whatever the user typed in. That is, if I created the user as Foo and the user logs in as fOo then everywhere where I use User.Identity.Name on my site, it'll show fOo.
Is there an easy way to work around this? I tried
var user = Membership.GetUser(User.Identity.Name).UserName;
but that gives me the exact same fOo value.
As a followup to cdmckay, if you'd want to have the User.Identity.Name correct as well, use
IIdentity newIdentity = new GenericIdentity(properlyCasedUser.UserName);
if (User is RolePrincipal)
User = new RolePrincipal(((RolePrincipal)User).ProviderName, newIdentity, ((RolePrincipal)User).ToEncryptedTicket());
else
User = new GenericPrincipal(newIdentity, null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With