Thursday, April 10, 2003


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 SourceEngineFrameworkUsersContent 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!

[A Blog for Graymad]
12:57:10 PM    trackback []     Articulate [] 

My code's controlled in my Vault. For the longest time I've been meaning to finally purchase Sourcegear's Vault, so finally today I placed my order for it and got my registration code. I was real lucky too since my trial of it was just about to expire on Sunday. Vault is a phenomenal revision control system. I've used a wide number of ones out there, including CVS, RCS, FreeVCS (which I used most extensively until Vault), SourceSafe, and Perforce. By far, I love that Vault ties into SQL Server 2000 for version control, and you can't forget that it's entirely written using .NET. Also, it's integration into VS.net is beautiful. Looking at their product roadmap, looks like they've got some nice things coming down the line. Luckily, you get free upgrades for a year after purchase (well, at least with the starter pack license that I bought).
[Robert A. Wlodarczyk's Blog]
12:50:41 PM    trackback []     Articulate [] 

BuildIt From Microsoft. Microsoft has a Team Development Build Tool called BuildIt which you can download here. From their site: "BuildIt.NET is designed to jump-start the build process used for development of .NET distributed applications. This download provides full source code and comprehensive documentation for the Microsoft Visual C#® development tool and Microsoft Visual Basic® .NET development system."
[The ASPSmith's Blog]
12:32:14 PM    trackback []     Articulate [] 

Unit Testing. A brief post about some Unit Testing resources.
[The ASPSmith's Blog]
12:31:29 PM    trackback []     Articulate [] 

When is it OK to use a DataReader. Neither the DataSet nor the DataReader is *the* object to use for data access.
Each one has its place, and here are some guidelines I've come up with that help to determine when each one should be used.
[The ASPSmith's Blog]
12:30:02 PM    trackback []     Articulate [] 

More reason to love the starter kits.

I just realized that I can, with the ASP.NET Community Starter Kit, easily create a new site for a given domain while the
current site is still running at the same domain name, thanks to the magic of host headers, and the fact that the CSK
allows communities to be configured at the subdomain level. So while the current production site is running at
.mysitename.com (and just mysitename.com), the new site can be set up at new.mysitename.com, allowing
development and testing without requiring a lot of extra work, and without disabling the current site. When
I'm ready to put the new site into production, all it will take is changing the target directory of the site in IIS,
and changing the subdomain in the ISPAdmin section of the CSK from 'new' to '*'.

I used this trick tonight to start work on a new site for my local civic association, since the CSK will make my work
in supporting the civic association and its members much simpler, while offering them more functionality than I was
willing to code on a volunteer basis. I love win-wins!

[A Blog for Graymad]

11:03:33 AM    trackback []     Articulate []