Do you think it's a good idea to create a login box as a user control?
I'm starting out learning some ASP.Net programming and I'm going to be making a little community website for my friends and myself.
I'm trying to pick up some good habits along the way.
I was thinking of having 开发者_如何学Goa usercontrol and have that 'loginBox' shows the appropriate textboxes and login button, but also show his username when he is logged in.
Do you think I should handle this as a user control or am I missing something as an ASP.Net newbie?
It sounds like a good idea to me - the user control could easily be placed anywhere on the site that you wanted to prompt the user for their credentials. This is exactly the kind of scenario that user controls were designed for.
It's a good idea. But please don't forget to use MasterPages: You may want to just place the login and "is logged in" on the MasterPage (or you could wrap them in a WUC and use it once on the MasterPage).
精彩评论