Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.Net membership strange behaviour

Status
Not open for further replies.

whatsthehampton

Programmer
Sep 13, 2005
121
CA
Hi there,

I'm either going mad or gone mad but if someone else could check this for me please.

A strange thing happened on one of my sites today and when I took a look it seems that when using either the membership logon control or even Membership.ValidateUser in code that; if you type a space before the username, it will log you in.

However, if you have set something like
Session("UserName")= HttpContext.Current.User.Identity.Name
then this session value will hold the space and thus not work?!
.Net 3.5

Am I mad?

Cheers,
Jon



 
I'm not sure if you are mad, but to avoid the issue, why don't you just trim all spaces before and after the username before you use it anywhere else in your code?
 
Thanks Jim,

I'm just curious that the login control (or from code) would log someone in with a leading space and actually capture that space - it should fail right?

Mad Jon

 
I agree, you would think it would fail. I guess you can google around and see if anyone else has come across this. Or maybe check the MSDN site and forums. It possibly could be a bug. But don't get too hung up on it. For now, you will have to chalk it up to one of those things that is, the way it is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top