Commerce Server Developer Wiki is Live!

As the title suggests, my latest foray into building more awareness around Microsoft Commerce Server in the developer community has become a reality. The Commerce Server Developer Wiki has been on the back of my mind for months now, and I’ve finally had a chance to make it available.

It’s currently suffering from a serious lack of content, so all you Commerce Server developers out there who are looking to help build the community and help out your peers please feel free to start contributing.

Enjoy! 🙂


Want Open Search Integration in Your Website…?

Over the past few weeks, Tatham Oddie, Damian Edwards and myself have been working on publishing a framework/toolkit for integration OpenSearch into any ASP.NET search enabled website. I’m pleased to announce we have finally hit a release!

The project is available at Tatham has a great post on how to integrate it into your site on his blog

OpenSearch is a technology that already has widespread support across the web and is now getting even more relevant with Internet Explorer 8’s Visual Search feature and the Federated Search feature in the upcoming Windows 7 release.

Now it’s time to make it even easier. Ducas Francis, one of the other members of my team, took on the job of building out our JSON feed for Firefox as well as our RSS feed for Windows 7 Federated Search. More formats, more fiddly serialization code. Following this, he started the OpenSearch Toolkit; an open source, drop-in toolkit for ASP.NET developers to use when they want to offer OpenSearch.

Today marks our first release.

So get on over to codeplex, hit up Tatham’s blog for instructions and drop the toolkit into your web site so you can take advantage of all the coolness that is OpenSearch.

How to Get Rid of the Pesky antivirus Check When Sending Files in MSN Messenger…?

UPDATE: When receiving a file, using the simple “cmd.exe” causes the command prompt to show. To get around this, use the /c “exit”. This will simply execute the exit command and continue, causing a command prompt to flash quickly:

cmd.exe /c “exit”

The boffins who build MSN Messenger decided a few revisions ago to introduce a security check into messenger that doesn’t allow you to send files such as zips to other contacts unless you have antivirus installed. It’s a nice feature to stop 12yr old girls from sending around, but it’s quite annoying if you’re running an OS like Windows 7 with UAC on because the need for antivirus software is only as great as your stupidity for accepting crappy files. In fact, I have been antivirus free on my laptop for the past year just because I don’t see the need for it when UAC is on and simple precautions are taken.

Anyway, I tried to send a valid zip to my colleague today and got the little warning.


Of course, I can’t continue because I don’t have antivirus installed. Or can I…?

I clicked Options and got my File Transfer settings.


Then thought, what would happen if I just told Messenger to use any old app, like say cmd.exe, as my scanner…


Try again…


w00t! 🙂

Quick Commerce Server Post – NotSupportedException on ResetPassword

As the resident CS go-to guy, I was hit up with a bug about a whacky exception message that was exposed whenever a user tried to reset their password. The stack trace resembled the following:

System.NotSupportedException – Microsoft.CommerceServer.Runtime, Specified method is not supported.

at Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipUser.ValidateUserAnswer(String answer)

at Microsoft.CommerceServer.Runtime.Profiles.UpmMembershipUser.ResetPassword(String passwordAnswer)

After staring at it for a couple of minutes and looking precisely at where we called it for a while I opened Reflector and gave it a crack. The UpmMembershipProvider and associated classes are in Microsoft.CommerceServer.Runtime.dll, found in C:\Program Files\Microsoft Commerce Server 2007\Assemblies.

Looking at UpmMembershipUser.ValidateUserAnswer(string answer), I found it used a variable called RequiresQuestionAndAnswer to determine whether validating the answer is required and throws a NotSupportedException if it is not. This variable was set in the UpmMembershipSettings class’ GetProfileConfiguration() method as follows:

this.requiresQuestionAndAnswer =

   inspector.DoesProfilePropertyExist("GeneralInfo.password_question", "STRING")

  && inspector.DoesProfilePropertyExist("GeneralInfo.password_answer", "STRING");

This tells me that the way we determine whether we require a Question/Answer combination to reset the password is actually by seeing whether the question and answer properties are exposed on the UserObject profile. Much to my dismay, these properties had been removed by someone…

Looking at the code again, I realised that an empty string was being passed through to ResetPassword because a custom answer validation was being performed in code before that. In the end, simply removing the parameter or passing null fixed this issue because ResetPassword() calls ResetPassword(null) which causes another branch to be executed that does not call the method ValidateAnswer.

Doing a quick search through the codebase revealed that there was another part of the system that called the method without a parameter. In fact, the same 3 lines were repeated almost exactly…

string generatedPassword = membershipUser.ResetPassword();
membershipUser.ChangePassword(generatedPassword, e.NewPassword);

Lessons learnt:

  1. Reflector is AWESOME!
  2. Put common code in an accessible place…

Using a VHD to Store stuff in Windows 7

Firstly, I’m not taking the credit for this one. It was Paul Stovell’s idea, but because he’s currently blogless I’m going to post it on mine… 🙂

The other day Paul was talking about a way of utilising the new VHD features of Windows 7 to keep all his documents and important stuff in a single location so that he can back them all up by copying one file. He had created a VHD and written a script that mounts it as a drive at start up. I thought this was a great idea, so I reproduced it and am now sharing it.

Firstly, create the VHD either using Virtual PC or the Disk Management console Action > Create VHD. Attach the VHD in Disk Manager then initialise and format it. Detach it and we can start scripting the attach process.

Create a text file named “Attach VHD.txt” with the following contents in %windir%\System32\GroupPolicy\User\Scripts\Logon entering the location of the VHD:

SELECT VDISK file="<Location of VHD>"

NOTE: I’ve used U as the drive letter. You can change this if it will cause a conflict or you just don’t like it.

In the same location, create a batch file named “Attach VHD.cmd” with the following contents:

DISKPART /s "Attach VHD.txt"

Open the group policy editor (Hit Start then type “group policy”) and drill down to User Configuration > Windows Settings > Scripts (Logon).


Open the the Logon script properties and add the batch file you just created (it should open the location you created the files in by default).


Now, log out and on again. It may take a few seconds, but the autorun screen should pop up when the drive is attached. Open Windows Explorer and you will see a new drive in your tree.


That’s it!

I’ve actually now moved all my user folders (i.e. Documents, Music, etc.) to the VHD, but if you don’t want to do that you can just use the libraries to include a folder and set it as the save location.

My Visual Studio Colour scheme

Ok, so here’s the current version of my colour scheme

What’s it look like?


Hope you like it. 🙂

Where’s them commerce server posts at…?

Ok, so it’s been a while since I spoke about writing some CS07 posts, but I promise they’re still on the way. We’ve finally gotten to the feature complete milestone on our project so there have been many a late night and weekend spent in the office getting things going recently.

Where am I at…? Well, I’m just finishing up a fresh virtual machine build for CS and I’m getting some good content together. Of course, with the new announcement of CS09, a lot has changed. Once I’ve finished up a bit of work on this 07 guff, I’ll hopefully get a chance to put together an 09 VM and put some content out there.

Windows Home Server available on MSDN

I’m a bit late to catch on to this one, but earlier this month Microsoft (finally) released WHS for download on MSDN. From the official announcement on the team blog:

MSDN availability will increase awareness of Windows Home Server with a larger community of professional developers and help further grow the ecosystem of software applications built for Windows Home Server.

Well, it’s about bloody time! There’s been a fair bit of public scrutiny over MS’s expectation for third party developers to write addons given that they had not released this earlier. I’m really looking forward to getting my server back up and running again after a much neglected Server 2008 installation.

Getting to know and love Microsoft Commerce Server

Over the past few months I’ve being working on quite a large web development project. This project involves the redevelopment and expansion of one of the largest e-commerce systems in Australia and the world. One of the base technologies chosen at the start was Microsoft Commerce Server 2007. This worried a few of us, but we were assured it was nothing like SharePoint 😉 so we were settled.

The team has grown to be quite big and well established. We now have 5 MVPs on board including some absolute superstars Damian Edwards, Tatham Oddie, Paul Glavich, Corneliu Tusnea and Luke Drumm. As a result we have a great grasp of ASP.NET and a great ability of delivering high quality software. The only thing our team was always missing was the Commerce Server knowledge…

At the beginning of the project, we were quite shocked by the amount of effort required to set up and develop with the framework. It was taking us days to get our environments to a functional state. Any changes to the underlying schema were taking at least a day of development then another day of roll-out. However, after a month or two, the sharp shooting pain that used to hit us whenever we needed to do something CS related subsided into a dull acceptance. It was quite sudden and really surprising how quickly a few of us had come to know and revere the beast that is Commerce Server.

Fairly soon after we started development we realised that not many people in Australia (or the planet) have used and/or blogged about their experiences with CS. Even Microsoft Australia were quite limited in their ability to support us because they had no one with any project experience. This was quite a blow because whenever we experienced a problem we didn’t have anyone to turn to for support.

It wasn’t until we had a consultant from Cactus Commerce – a consulting company based in Canada that specialises in e-commerce systems and CS – that we began to take hold of the beast. The two weeks we dealt with them helped us leap ahead and get to a point where we are no longer afraid…

We are now at a point where CS schema modifications take an hour to develop and roll out and Pipeline Components take minutes to put together. So, over the coming weeks I’ll be trying to share as much of the basic knowledge I’ve gained as possible. I’ll be writing about everything from connecting to CS in-proc versus web services to making schema modifications easily and writing Pipeline Components the right way in the hope that someone will get some benefit out of it.

I’m still here…

Yes, my blog has been exceedingly quiet over the past few months. I’ve gotten into the bad habit of queuing unfinished blog posts. That’s over, I’m clearing them out and starting fresh. Time to come back to life… 🙂