Wednesday, December 8, 2010

PDFWebViewer.NET tip 1: protect your documents from direct access

Most of the PDFWebViewer.NET demos use the FileSystemStorageProvider to store PDF documents in the ~/documents folder. This means the documents are stored within the root of the website and they can be downloaded directly. If you know the file name, that is. To prevent direct access, you can either store the documents outside the web application root or setup some protective measures.

Thursday, October 7, 2010

Moving a Sitefinity site into another database

I’ve come across a couple of occasions where I needed to copy the structure and layout of one Sitefinity site into an existing Sitefinity database. For example when moving from a development or staging environment to production.

I did some research and found no point-and-click solution for this so far. The Sitefinity API does support duplicating pages but that does not seem to work well for moving pages from one database to another.

Then I came across the handy site export feature in Sitefinity. This allows you to export an entire site into a zip. The zip can be used to create a new site. Under the hood there’s and ExportModule that’s doing all the work. The zip contains both the site’s files and a set of XML files that hold the site structure and any content you may have entered. So, to duplicate a site into an existing database here’s what to do:

Tuesday, June 1, 2010

Git tips 3: managing two parallel versions

The code I deliver to my customers are usually just a little bit different than the code I use for development. Config files contain different connection strings, dependencies are in different locations, that sort of thing.

Because of this I usually have two branches:

  • master – my main development branch
  • production – the customer version

Before a delivery to the customer I merge the finalized changes from master to production.

Merging is a breeze with Git, but in this scenario it keeps breaking me up. Git will by default try to do a Fast-Forward merge. That means that the changes aren’t really merged, the head for the production branch is just set to the head of the master branch, effectively overwriting the small but significant differences in the production branch.

To prevent this from happening disable fast-forward merge ( --no-ff ). After the merge I like to verify it all still works so I prevent Git from committing the merge ( --no-commit ).

The final merge command looks like this:

git merge --no-ff –no-commit master

Wednesday, May 12, 2010

Git Tips 2: Getting a list of all files added and removed

When I send an incremental patch or release to a customer I usually include a list of the files that were added and removed. That makes it a lot easier for the people on the other end to submit the changes into source control.

The following command will list all the files that were added, moved or removed between two commits into a text file.

git diff -–summary commit1 commit2 > changes.txt

Commit1 and commit2 can be anything like a branch name, a commit id or a tag.

See also: Git tips - zipping all changed files

Installing Sitefinity on 64-bit Windows 7

I’ve been evaluating a bunch of ASP.NET based CMSes over the last two weeks. One of the more interesting commercial ones is Sitefinity from Telerik. I like it enough to actually recommended it to a customer who asked me to figure out what CMS to use.

Installation of Sitefinity 3.7 is anything but simple though. There’s a comprehensive installation guide but that’s missing a crucial bit of info for installation on 64-bit Windows 7. This caused the project manager site to show nothing but 404.17 errors.

The solution is to enable 32-bit applications on the AppPool advanced settings. See step 2 of the installation guide and the screenshot below.

Enable 32-bits applications in IIS7