Community Starter Kit Modifications
While playing with the ASP.NET Community Starter Kit, I noticed that while it provided 95% of what I needed out-of-the-box (so to speak), there have been a couple of things that I wanted to tweak. Since these seemed like things that might be useful to other folks using the CSK, I posted these modifications to the ASP.NET Forums forum dedicated to the CSK.
Both modifications have to do with administering users in the CSK.
The first modification was a very simple one for the Edit Users administration area. As installed, the main Edit Users page displays only the users whose names begin with "A". Since my site doesn't have a huge number of users, and I don't expect it to in the near future, I wanted to be able to see all the users at once. Now, I could do this just by clicking the "All" link in the alphapicker control that appears on that page, but why not save one click (times as many times as I use the page). Fortunately, this modification required adding a single attribute to the alphapicker control tag in the page. The steps are detailed in the forum post here.
The second modification was somewhat more involved, but more important. As installed, the current version of the CSK does not provide support for deleting users from a given community. Since there's also no approval process for new users (i.e. - once someone registers they are able to log in without prior approval from the site admin), it would be useful to be able to remove users who are not welcome (for whatever reason).
To accomplish this required modifying the main Edit Users page, adding a new Delete User page, creating a helper function in the UserUtility.vb module, and writing a new stored proc. The steps and code are outlined here.
Another modification I made (which was a bit more of a hack, so I didn't post it to the forums), which makes the ability to delete users more useful, was to add some code to notify me via email when a new user registers at one of my sites. That way, if someone not on my personal 'approved' list tries to register, I can use the newly added delete user functionality to remove their account.
For this modification, I added the following lines to the btnRegister_Click event handler in the Register.vb file in the \Source\Engine\Framework\Users\Content\ folder:
'code for email notification of administrator added
'by G. Andrew Duthie on 4/4/2003
Dim CI As CommunityInfo = CommunityUtility.GetCommunityInfo()
Dim message As New MailMessage()
message.From = "Admin@" & CI.Domain
message.To = "Admin@" & CI.Domain
message.Subject = "New User Registered"
message.Body = "A new user with the username: " & _
ctlRegisterForm.Username & _
" has registered on " & CI.Domain & "."
SmtpMail.SmtpServer = CommunityGlobals.SmtpServer
SmtpMail.Send(message)
just above the line:
FormsAuthentication.RedirectFromLoginPage(objProfile.Username, _
False)
I describe this as a hack because the mailing code is stuck in the procedure itself, with hard-coded (at least partially) addresses, rather than taking advantage of the messaging and mail infrastructure built into the CSK. This modification, like the one for deleting users, requires re-building the CSK assembly.
The main point to get about these modifications isn't what a smart guy Andrew is. It's that the code within the CSKs is sufficiently logical in its design, and sufficiently well-commented, that it is relatively easy to modify the code to do exactly what you want it to do. Which is why I think that the starter kits rock!