This step wasn’t too difficult, because login and authentication are so central to the idea of a website, and ASP has a nice login control built into Visual Studio.
I created a test user, and then a login page, and a destination page (for now, the profile page). I then added a login control, and made some changes to the default settings:
- I changed the Username label to Email Address, since that’s what we’ll be using as the username for this website.
- I added a “Forgot Password” link, which goes nowhere for now, but will I figure will be necessary later. (actually that might be considered a bad thing in Agile philosophy, since you don’t want unimplemented features in there that aren’t specific requirements, in anticipation that they will be later — you never know)
- There’s already a “Remember Me” checkbox that presumably sets a cookie on your browser so you don’t have to login each time. I left it in there… even though it was part of the requirements (again, bad for Agile)… but at least this time, it’s all implemented automatically by ASP. And plus, I’m the customer too, and I just decided to make “Remember Me” a requirement. So there!
- I used the auto-format on the login control so that it wasn’t completely ugly. But no worries — I intend to come back later in a future release and revamp the UI.

Login Control

Login Failure
In the process of setting everything up and reading a little bit here and there about ASP’s authentication system, I got some early indications that using an email address as a username was actually not a trivial thing to do. ASP isn’t set up to do this, even though it’s something that many sites do.
I don’t recall the exact reasoning why I wanted to go with an email address as username, instead of another username… the thing is, if a user changes their email address, the username field is a readonly field, so I would have to essentially clone a new user and delete the old account.
This has significant implications, but there are some articles out there dealing with it, since it’s obviously something other people have had to deal with. So I’m not going to worry about for now, and we’ll see how this decision plays out later on.

Subscribe to China WBI