Thursday, January 10, 2013

Configuring host headers for https binding

The IIS Management UI only lets you configure host headers for the http protocol (binding). Wondering what host header is? Check the following abstract taken from wikipedia
The "Host" header distinguishes between various DNS names sharing a single IP address, allowing name-based virtual hosting. While optional in HTTP/1.0, it is mandatory in HTTP/1.1.

However, while the UI is not letting you doing it, it does not mean you cannot! And actually, it is really easy to do as long as you can open a command prompt. The trick is to use the magical Appcmd.exe tool, which allows you to do almost anything in IIS. The following command line shows how to add a https host header for for a web site named "MyWebSite" with a url "mywebsite.mydomain.com"
appcmd set site /site.name:"MyWebSite" /+bindings.[protocol='https',bindingInformation='*:443:mywebsite.mydomain.com']
Read Configure a Host Header for a Web Site for more details

Thursday, March 25, 2010

Open XML SDK 2.0 went RTM!

Microsoft finally released the so awaited version 2.0 of its Open XML SDK, which is supposed to radically improve the performances compared to v1.0 that was simply unusable!

I did not have time yet to test it out but I will try posting some results later on.

In the meantime, you can download it here

Tuesday, March 23, 2010

MSBuild - Cleaning a folder

It is a common need to clean the destination folder (deleting all files and folders) when you automate your deployment builds. Unfortunately, MSBuild does not have a built-in task that does it all for you, and googling about it does not give you a clear answer.

It is however pretty easy to do by combining the Delete and RemoveDir tasks together. Below is a code snippet that does it.

The code should be self-explanatory enough with the few comments.


<Project ToolsVersion="3.5" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <!-- Folder to clean - Trailing slash required -->
        <DeleteRoot>D:\Test\Deploy\</DeleteRoot>
    </PropertyGroup>
    <Target Name="Default">
        <ItemGroup>
            <!-- Item to get all files recursively in the DeleteRoot folder -->
            <FilesToDelete Include="$(DeleteRoot)\**\*.*" />
            <!-- Item to get all folders from the files to be deleted -->
            <FoldersToDelete Include="%(FilesToDelete.RootDir)%(FilesToDelete.Directory)" Exclude="$(DeleteRoot)"/>
        </ItemGroup>
        <!-- Display what will be deleted -->
        <Message Text=" # @(FilesToDelete)" Importance="normal" />
        <Message Text=" # @(FoldersToDelete)" Importance="normal" />
        <!-- Delete the files -->
        <Delete Files="@(FilesToDelete)" Condition=" $(DeleteRoot)!=''" /> 
        <!-- Remove the folders -->
        <RemoveDir Directories="@(FoldersToDelete)" Condition="$(DeleteRoot)!=''" />
    </Target>
</Project>

Thursday, November 26, 2009

French characters on a qwerty keyboard

Since I am using Qwerty keyboards, it is not that easy to type the accented characters in french or even the euro symbol.

I can still use the Windows Character Map, or remember the ASCII code, but I can now also open up a website such http://www.copypastecharacter.com/, which simply does what it says he does (Copy/Paste characters)

Monday, November 02, 2009

Resharper 5.0 EAP

Resharper 5.0 is on its way...Despite the VS 2010 support, there are some promising new features
  • External PDB support
  • Project Refactoring
  • Better ASP.Net support
  • And much more as the JetBrains' Guys demonstrated us over the past years...
Visit their blog for all details

Wednesday, October 21, 2009

Tools I like and use

It's now a casual thing to publish the tools you used, so here is my list (for a .Net developer):
  • Visual Studio 2008/2010 Pro
  • Visual Studio Power Commands Add-In
  • Web Deployment Project 2008/2010
  • JetBrains Resharper 5.x
  • Sybase PowerDesigner
  • Enterprise Library Blocks (Data, PolicyInjection)
  • MyGeneration (Code Generation)
  • MS Build (+ Commuity Tasks)
  • NUnit
  • Wix
  • JetBrains TeamCity
  • Redgate Reflector
  • Redgate SQL Compare
  • TortoiseSVN
  • VisualSVN
  • SandCastle + Help File Builder
  • Firefox (with Firebug)
  • Chrome
  • Notepad++
  • Softerra LDAP Browser
  • Paint .Net
  • TrueCrypt
  • FileZilla
  • SyncToy 2.0

If you'd like more tools, check out others' list

Monday, September 28, 2009

MS SQL Server Profiling - Missing Indexes

If you are using MS SQL Server, there is a good chance that you have (or will have) to monitor and improve some of your queries.

Since its 2005 edition, SQL Server provides a feature to find the missing indexes, giving you some information about potential indexes that it thinks would improve performances. This information can be really useful to proactively improve the queries that are getting slower when the number of records grow.

However, like almost everything, this is not all back or white...you should consider the proposed information, but not create dozens of indexes on every table if you don't want your server to spend all its time, processing and especially I/O to maintain indexes.

On the same topic, you will find a couple of nice SQL statements below:

Wednesday, July 01, 2009

Tuesday, December 16, 2008

Impersonate a user in SQL2005

It's often useful to run a stored procedure or any script with the permissions of another user (i.e. impersonate a different user than the current one).

It is possible to do so since SQL 2005 is out there, and is as simple as shown below:

EXECUTE AS USER = 'anotheruser'
GO

--Your SQL Statement

REVERT
GO


Note the REVERT command to restore the original user.

In order to impersonate a user, you will grant the IMPERSONATE rights on the user you want to impersonate to the user who will be impersonated it.

GRANT IMPERSONATE ON USER:: [AnotherUser] TO [MyCurrentUser];

Users with sysadmin role can impersonate any user, without being granted the IMPERSONATE right.

For all details, check the online reference @ http://msdn.microsoft.com/en-us/library/ms181362.aspx

Running multiple instances of Firefox

It is always useful to have several browser instances when developing and testing so that you can "impersonate" several different users at the same time.

IE does it for each different window; Firefox always shares the same instance even for different windows.

As per the title of this entry, you already know that Firefox allows you to do it but the "feature" is simply not available as a simple check box.

1. Start Firefox with the Profile Manager
If you installed Firefox in the default installation location, open a command prompt and run "C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote -ProfileManager
2. Create a new profile
You can choose any name but I used "testprofile"
3. You are ready now to run a second instance of Firefox with the testprofile
Again, if you installed Firefox in the default installation location, open a prompt and run "C:\Program Files\Mozilla Firefox\firefox.exe" -no-remote -P testprofile
If you need to run the other instance on a regular basis, you will simply create a shortcut with the command line above.

Need to run more than 2 instances at a time? You will need to repeat the process above and create more test profiles.

For more command line arguments, check the Firefox KB.