ASP.NET 2.0 Membership

Today I’ve been spending a bit of time fiddling around with Visual Studio 2005, particularly the ASP.NET 2.0 membership functionality. When I visited to see what they had to say about it, I came across 5-part series of articles. The examples are in VB.NET, so I’ve been rewriting them in C# (my preferred .NET language) as I go along. What stood out about their information message example in part 4 of the series was that they added a label to their login page and set the text string based on the error details.

It seemed to me that there should be a property in the Login control that could be set programmatically instead of adding a label that results in two error messages for the user to look at. It didn’t take much digging before I found it. The property: FailureText.

Here’s how my revised code looks:

protected void Login1_LoginError(object sender, EventArgs e){

MembershipUser userInfo = Membership.GetUser(this.Login1.UserName);

if (userInfo == null){

//The user entered an invalid username...

SetLoginFailureText(string.Format("No account exists with the username '{0}'.",this.Login1.UserName));

} else {

if (!userInfo.IsApproved){

SetLoginFailureText(string.Format("The account with the username '{0}' has not yet been approved by the site's administrators.", this.Login1.UserName));

} else {

if (userInfo.IsLockedOut){

SetLoginFailureText(string.Format("The account with the username '{0}' has been locked out.", this.Login1.UserName));





private void SetLoginFailureText(string failureText){ this.Login1.FailureText = failureText; }

Effective Bug Reporting

This has been a real problem at work lately. I’ve decided to write a document to send to people who report bugs to try and stem the tide of useless “it doesn’t work” reports. I found a nice long piece on effective bug reporting by Simon Tatham here. I’ll probably use it as a reference for further reading because I envisioned something much shorter than seven pages.

Community Server 2.0 Quick Image Buttons

The blog I’m building for a client at work needed an image button to trigger searches instead of the standard link button. After my ill-advised attempts to extend CommunityServer.Controls.IButton, the consultant I’m working with recommended a far simpler solution–changing the ASP.NET LinkButton tag to enclose an HTML image tag with the border attribute set to zero (0).

If you want to use the same technique, start with this sample skin file.

A “Most Viewed Blog Posts” control for Community Server 2.0

The Code Project is one of my favorite sources for finding out how to do things on the .NET platform.  Since my blog was down for a bit a couple days ago, I thought I’d put an article there on the latest bit of customization I’ve done to Community Server.  If you’re interested in the article, visit this link to read it.