Sitefinity Lightning CTP

With all the new features in the latest 5.2 release of Sitefinity, it’s easy to almost miss Sitefinity Lightning. And after finally taking the time to play with it today, you surely do not want to miss it!

Wunderlist: The Ultimate Solution for Managing Tasks

So finally, after many years of searching (this is a problem I’ve been trying to solve long before WP7), I finally discovered Wunderlist. Rarely does one find a solution so complete, so closely matched to their needs that when it happens, you just have to sit back and enjoy it.

Upgrading From Sitefinity 3: Url Rewriting

This post is part of a series exploring my migration from Sitefinity 3 to 4.4. Some of this information may become obsolete as newer versions are released. Always watch the official Sitefinity website for the latest info.

As part of the migration of my website from Sitefinity 3, I updated both the Url format for pages (now extensionless) and blog posts (also extensionless and different format) for better readability and SEO. This of course would leave a wake of broken links and search results linking to the old Urls.

There are many options available to resolve this, such as developing a custom HttpHandler to intercept the old Urls. Fortunately, there is a fantastic tool that handles all of this for you.

IIS Url Rewrite

IIS Url Rewrite is an extension for IIS that enables a wealth of Url handling features, including the two I needed for my site: Rewriting and Redirecting.

Redirects

As part of my website update, I moved some of the content such as the Sitefinity 3 Toolkit info to my company website Page Init Solutions. So I need to redirect all these requests from this site to that one.

The Url Rewrite module has an option for creating redirects, which you can manage in a friendly GUI for IIS.

IIS-UrlRewrite

You can also manage this directly in the web.config file. Here are some of the redirects I put in place using the module.

 <rewrite>
            <rules>
                <clear />
                <rule name="Redirect rule1 for PageInit">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{PageInit:{REQUEST_URI}}" pattern="(.+)" />
                    </conditions>
                    <action type="Redirect" url="{C:1}" appendQueryString="false" />
                </rule>
            </rules>
            <rewriteMaps>
                <rewriteMap name="PageInit">
                    <add key="/software.aspx" value="http://pageinit.net/software" />
                    <add key="/software/Sitefinity/Sitefinity_Toolkit.aspx" value="http://pageinit.net/software/sitefinity-toolkit" />
                    <add key="/software/jQuery/Banner_Swapper.aspx" value="http://pageinit.net/software/jquery-banner-swapper" />
                    <add key="/software/Sitefinity/Sitefinity_Password_Recovery.aspx" value="http://pageinit.net/software/sitefinity-3-password-recovery-tool" />
                    <add key="/blog.aspx" value="http://www.selarom.net/blog" />
                    <add key="/contact.aspx" value="http://www.selarom.net/contact" />
                </rewriteMap>
            </rewriteMaps>
      </rewrite>

This allowed me to easily map old Urls to new, including the old .aspx extensions for pages. Adding a new redirect is as simple as adding a new entry in the list.

Url Rewriting

The new blog Url format makes for SEO friendly as well as functionally useful Urls. They are, however, starkly different from the original format from Sitefinity 3, and clearly, redirecting every single post individually is not an ideal solution.

Fortunately, the Url Rewrite Module also has excellent support for Url rewriting using Regular Expressions. Using Regex, I was able to easily rewrite the old format of /YYYY-MM-DD/Title to the new /YYYY/MM/DD/Title format now used by Sitefinity. I was even able to rewrite some of the urls for the list of blogs by Tag and Category.

Admittedly, working with Regular Expressions is probably one of my weakest programming skills, and despite what everyone keeps saying on Twitter, it does NOT get easier the more you do it! That being said, here are the Regex rewrites I created for this site. If anyone has suggestions for improving or consolodating them, by all means let me know!

 <rule name="BlogPosts" stopProcessing="true">
                    <match url="^(.*)/([0-9]{4})[-]([0-9]{2})[-]([0-9]{2})/(.*)$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Redirect" url="{R:1}/{R:2}/{R:3}/{R:4}/{R:5}" />
                </rule>
                <rule name="BlogYear2Month">
                    <match url="blog\.aspx$" />
                    <conditions>
                        <add input="{QUERY_STRING}" pattern="Year=([0-9]{4})" />
                        <add input="##{C:1}##_{QUERY_STRING}" pattern="##([^#]+)##_.*Month=(\d{2})" />
                    </conditions>
                    <action type="Redirect" url="blog/{C:1}/{C:2}" appendQueryString="false"/>
                </rule>
                <rule name="BlogYear1Month">
                    <match url="blog\.aspx$" />
                    <conditions>
                        <add input="{QUERY_STRING}" pattern="Year=([0-9]{4})" />
                        <add input="##{C:1}##_{QUERY_STRING}" pattern="##([^#]+)##_.*Month=(\d{1})" />
                    </conditions>
                    <action type="Redirect" url="blog/{C:1}/0{C:2}" appendQueryString="false"/>
                </rule>
                <rule name="BlogYear">
                    <match url="blog\.aspx$" />
                    <conditions>
                        <add input="{QUERY_STRING}" pattern="Year=([0-9]{4})" />
                    </conditions>
                    <action type="Redirect" url="blog/{C:1}" appendQueryString="false"/>
                </rule>
                <rule name="BlogTag">
                    <match url="blog\.aspx$" />
                    <conditions>
                        <add input="{QUERY_STRING}" pattern="tag=(.*)" />
                    </conditions>
                    <action type="Redirect" url="/blog/-in-Tags/Tags/{C:1}" appendQueryString="false"/>
                </rule>

Wrapping Up

The IIS Url Rewrite Module is a fantastic tool for ANY website that has a need for rewriting or maintaining Urls, and is highly recommended for anyone attempting to migrate to the latest verion of Sitefinity.

Finally, here are a few resources I found extremely helpful in preparing these rewrites and redirects:

JustCode is JustSmart

I was doing some coding today when I discovered something very slick about Telerik’s JustCode tool I just had to share.

Telerik-Just-Code-Context-Menu

I needed to add a property to a class, and my coding style puts private properties and their public accessors in separate #regions. I added the private member to the “Private Properties” region, and decided to let Just Code stub it out for me, expecting it to generate the public property directly beneath my private variable. I figured I would just copy and paste it into the appropriate region.

Imagine my surprise when instead of generating the code beneath my variable, it popped up inside my “Public Properties” region!

Telerik-Just-Code-Property

I thought that this might be a fluke, so I added a few test regions in between to see if it was just grabbing the first one after it. Sure enough, however, it popped right back into the right region!

Telerik-Just-Code-Property2

It’s the little things, you know?

More about JustCode ยป

Sitefinity: Easy SP Upgrades with DiffMerge

As part of the process of preparing the Sitefinity Toolkit 1.1 update for release later this weekend, I needed to upgrade my sites to the latest Sitefinity SP3 update.

For those of you who’ve done this, you know it’s MOSTLY a simple process, but can get tricky when copying the /Sitefinity folder files, because, like me, many of you probably customize or modify these files to meet your needs. Sitefinity addresses a lot of this by supporting external templates, but sometimes it’s easier to just edit the files directly.

However, this becomes a problem with every SP release because these files can get overwritten by newer versions. Fortunately, there’s an easy way to ensure that you get the latest code files without sacrificing your customizations. And best of all it’s FREE!

Sourcegear is a company specalizing in Source Control for Small to Medium sized businesses. I’ve been using their Fortress software for some time now, and have been very satisfied. And recently, I discovered that it comes with their FREE DiffMerge tool, which is also available as a separate free download.

What I love about this program is that you can point it at two FOLDERS, not just files. So all you have to do is select your site’s /Sitefinity folder and the /Sitefinity folder from the update/patch:

diffmergefolder

And when the tool runs it will show you all the files that have changed:

diffmergelist

You can then go into each file and see exactly where the files differ. You can over write your file with the patch, or keep your changes if they are still required.

diffmerge

This tool has been a HUGE time-saver, as I have done literally dozens of customizations to core Sitefinity files, and there’s no way I’m going to remember them all. makes updates easy, and more importantly, SAFE!

That’s all for today, I’ll be working over the weekend to get the SP3-compatible release of the Sitefinity Toolkit up within the next few days. Thanks to all for your continued patience!

Note, although I do use SourceGear products, I am in no way affiliated with the company, and received no compensation or incentive for writing this article.