Sometimes you’re hired by a company which is a bit rigorous on blocking outgoing communication. A security consultant would probably agree on this practice, but most developers won’t. Nowadays a lot of services in the cloud operate on different ports. Azure services don’t always operate on port 80 and 443, hosted noSQL providers have connection strings with (seemingly) random ports, etc. It’s not always easy to get approval to open ports in the company firewall, especially if you’re doing some tests and proof of concept projects. A way to get around this policy is to create a virtual machine in Azure.

When you choose to create a new virtual machine from the gallery you can create an image with Visual Studio pre-installed on it. Even the latest versions are available!


After completing the wizard you’ll have to wait a few minutes for the machine to spin up.

Don’t be happy just yet. When you try to connect to the machine, you’ll probably get a timeout or some other connection problem. This is because the configured RDP port is probably also blocked by your company firewall. A way to fix this is to set the public RDP port to 80 or 443 (which company would block normal HTTP(S) traffic?). This setting can be configured on the Endpoints tab of the virtual machine.


After doing so you will be able to log in to your virtual machine and start working on your cloud project.

If you know up front which ports are open/free, you can also configure this setting when creating the virtual machine. On step 3 in the wizard you will be prompted to configure some settings. Just change the public port from AUTO to 443 and you will be able to RDP when the machine spinned up.


Please note I don’t advice to use this method for real production development. If you need ports to be open during the development period, please ask your system administrator to do so. Company policies exist for a reason (well, I assume they do).

The past couple of days I’ve been working on migrating my blog from the Orchard CMS to MiniBlog. The main reason for me to migrate to a different system is because I don’t work a lot with Orchard anymore. There were also some crashes from time to time which I couldn’t explain.

I’m currently hosting my websites on Azure Websites, because of that I didn’t feel much for using a database system. SQL Azure is very nice of course, but it can also be quite expensive, especially if you don’t really need the features. The alternative is SQL Compact, but I’m not very keen on using this as well.

While searching for a database-less blogging system, I came across several solutions like Ghost, Jekyll and MiniBlog. All of these systems are slightly different and work with different techniques. The main reason I’m using MiniBlog as my new blogging engine is because it’s based on .NET. I could list all the cool features which are included, but as it’s already stated on the GitHub page, I won’t repeat it over here.

MiniBlog is a system which saves it’s posts in XML files. Therefore, I had to migrate all of my posts from the Orchard database to the files which MiniBlog understands. There’s already a project on GitHub called MiniBlogFormatter. This tool is able to export posts from DasBlog, BlogEngine.NET and WordPress to the MiniBlog format. I’ve used the code from this project as a basis for exporting my own Orchard posts.

It would have been cool if I was able to extend the MiniBlogFormatter project with my Orchard exporting code. There was however one caveat for this, I don’t know how to access the Orchard API from a remote application. I do know how to create modules, therefore I’ve created a module which was able to export the posts in the necessary format. If you want to know how to create an Orchard module yourself, there’s a post on this blog where I elaborate more on this.

The module itself isn’t fool-proof and user friendly (yet). It’s available on GitHub, so you can use it if you want or use it as inspiration for your own solution.

You can see I’ve created a new route so my own controller will be triggered.

new RouteDescriptor {
    Priority = 5,
    Route = new Route(
        new RouteValueDictionary {
                                    {"area", "JanVNL.Migrate"},
                                    {"controller", "Migrate"},
                                    {"action", "index"}
        new RouteValueDictionary {
                                    {"area", "JanVNL.Migrate"}
        new MvcRouteHandler())

The MigrateController will eventually hit the Initialize-method in the GetBlogPost class, which looks like this:

internal ICollection Initialize(bool redirect)
	var blog = Retriever.GetBlog(_blogService);
	var blogPosts = _blogPostService.Get(blog, VersionOptions.Published);
	_allBlogPosts = new List();
	string redirects = string.Empty;
	foreach (var blogPostPart in blogPosts)
		if (redirect) 
			string currentSlug = GetUrl(blogPostPart);
			string redirectRule = "<location path=\"{0}\"><system.webServer><httpRedirect enabled=\"true\" destination=\"{0}\" httpResponseStatus=\"Permanent\" /></system.webServer></location>";
			redirects = redirects + string.Format(redirectRule, currentSlug);
		else {

			var blogPost = new BlogPost();
			blogPost.Title = blogPostPart.Title;
			blogPost.Content = blogPostPart.Text;
			blogPost.PubDate = blogPostPart.PublishedUtc.Value;
			blogPost.LastModified = blogPostPart.PublishedUtc.Value;
			//blogPost.Categories = blogPostPart.;
			blogPost.Slug = GetUrl(blogPostPart);
			blogPost.Author = blogPostPart.Creator.UserName;
			blogPost.IsPublished = true;

			Storage.Save(blogPost, string.Format("C:\\BlogPosts\\{0}.xml", blogPost.Slug));
	return _allBlogPosts;

In this piece of code I’m iterating through all blog posts, converting them one by one to a BlogPost object and storing them using the Storage class. The BlogPost and Storage class are copied from the MiniBlogFormatter repository.

You probably also noticed the if-statement with the redirect variable. I’m using this variable to switch between saving the blog posts and generating a web.config block for adding the redirect rules. To retrieve the redirect rules, you have to set a breakpoint in the code and copy the contents of the redirects variable to the web.config. Not very user friendly, indeed.

This code worked for Orchard 1.7.2. I’m fairly sure it will also work on Orchard 1.5.x. and above. You can try it on other versions of course, most of the time you’ll get decent warnings or errors if something doesn’t work properly.

There are 2 ‘features’ in SharePoint (MOSS2007) which have kept me busy for quite some time in my last project. Yes, you’ve read it right the first time, my latest project was a MOSS 2007 web portal. Of course these issues aren’t really quirks as the product behaves by design, but it has kept me busy for more time as I would bargain for.

First quirk:

For some reason I had to create a console application to query the SharePoint user list and delete the users. Normally this doesn’t pose a problem at all. However, this time the following error was thrown every time:

The Web application at http://your-website-here:80 could not be found. 
Verify that you have typed the URL correctly. 
If the URL should be serving existing content, 
the system administrator may need to add a new request URL mapping to the intended application.

Quite strange, as the website does exist, I even double checked it.

After doing some research on the matter it turns out you need to specify the Platform target for your application. Mine was set to Any CPU and had to be changed to x86. After changing this specific option the code was running correct.


Second quirk:

The other thing I ran in to was not having permission to do anything on my site collection. We were using the stsadm export and stsadm import commands to move SharePoint site applications between environments.

This means I was familiar with setting the proper permissions on the web application and site collection. However, this time it didn’t work. After having spent several hours on this problem I finally noticed a feature which I had never seen before. Apparently you can set a site lock when doing an export on a website. This makes sense as you don’t want your data to change much when doing this.

However, after doing an import, you also need to remove the site lock. If you fail to do so, no one can make changes to the content of the website. To fix this, you can use the stsadm command, like so:

stsadm -o setsitelock -url http://your-website/ -lock none

The full documentation can be found on MSDN/Technet. You can also check the current site lock with the getsitelock operation.

Because I’m a developer who loves a GUI I’ve also found the option in Central Administration. Navigate to the Application Management tab and search for the Site collection quotas and locks.


On this page you can select your site collection and set the lock status for it.


After setting it to the status Not locked and you press OK, your site should be editable again.


Even though this post references some prehistoric software platform, I do hope you find it useful.

There are some cool features available in Linux. In an earlier post I already mentioned the apt-get functionality which is now also offered in Windows via Chocolatey. One of the other cool features is being able to execute something in the terminal as an Administrator by specifying sudo in the command.

Lucky for us Windows people, someone has created a tool which is able to do something similar as the Linux sudo-command. The tool is called Elevate and can be downloaded from over here:

After you have downloaded the zip-file from the website, copy the appropriate executable to your System32-folder and you are good to go!

By specifying the Elevate command in the command prompt, PowerShell window, Windows Search or Run-window the command will now be executed as an Administrator.




Depending on your UAC settings, you are still prompted with the question if you really want to run the application (Notepad) as an Administrator.

I think this functionality could be extremely useful if you want to run specific commands of a script as an Administrator.

Even though the Windows operating system is one of the best in my opinion, there are always something which is only available in a different OS. For example the apt-get functionality in Linux. I don’t know how this works exactly, but from my basic understanding it’s some kind of repository with a lot of software and libraries which you can download to your device by typing something like the following in a terminal window:

apt-get SomeSoftware

Why this feature isn’t available by default in Windows is a mystery to me.

Quite some time ago, Scott Hanselman blogged about Chocolatey. Chocolatey is something similar to the apt-get feature from Linux, but now available on a Windows machine. (disclaimer: it’s not really the same, but works for me)

Ever since reading this post I wanted to use this awesome piece of software, but all my systems were already up-to-date and never needed it. As of this week, I’ve started working on a new project. Therefore, a new virtual machine had to be installed and configured. An awesome excuse to start using Chocolatey!

With Chocolatey you can install all kinds of software, just by typing a command in your Command Prompt or PowerShell window. It will automatically download and install the software for you. The only thing you need to do is wait for the command to finish.

Installing Chocolatey is easy also, just open up a command prompt window and copy-paste the install text from the homepage to your window. After the installation has finished, the window will look something like this.


Now you are ready for the real fun, installing software via scipting!

Visual Studio 2010 was already installed on my development machine, so I had to think of something else which is necessary. My choice was ReSharper. If you are unfamiliar with the Chocolatey commands for installing this software, just head up to the website, search for the software in the search box and everything is explained as the search results show the exact commands you need to install the software.


Installing ReSharper can be done by just typing the following in the command prompt window:

cinst resharper

Hit [Enter] and wait.


When finished, the gods are thanked appropriately and the software is good to go.


Of course, you don’t want to install all your development software manually via the prompt window. Therefore, it’s also possible to script it!

I’ve created a small Install.ps1 and placed it in a DropBox folder, so I can use it everywhere. The contents look like this.

# Install Visual Studio 2012 Ultimate
cinst VisualStudio2012Ultimate
# Install Visual Studio 2012 Update 4
cinst VS2012.4
# Install Visual Studio 2013 Ultimate
cinst VisualStudio2013Ultimate
# Install ReSharper
cinst resharper
# Install Notepad++
cinst notepadplusplus
# Install Fiddler
cinst fiddler
# Install FileZilla
cinst filezilla
# Install SQL Server 2012 Express
cinst SqlServer2012Express
# Install KeePass
cinst keepass
# Install Spotify
cinst spotify
# Install GitHub for Windows
cinst githubforwindows
# Install VLC Player
cinst vlc
# Install Beyond Compare
cinst beyondcompare
# Install dotPeek
cinst dotPeek
# Install dotTrace
cinst dotTrace
# Install Remote Desktop Connection Manager
cinst rdcman
# Install Sublime Text 2
cinst sublimetext2
# Install PowerGUI
cinst PowerGUI
# Install TreeSize
cinst treesizefree
# Install DropBox
cinst dropbox
# Install Google Drive
cinst googledrive
# Install SkyDrive
cinst SkyDrive
# Install Google Chrome
cinst GoogleChrome
# Install Mozilla Firefox
cinst Firefox


There’s probably much more to Chocolatey, but this what I’ve figured out so far. It’s too bad not all software is supported for Chocolatey yet, but it’s a great start. Most software you need is already in the repository and you can add new packages yourself on the website.