Creating Http Redirects in IIS7 on Virtual Directories like IIS6

In IIS6 when creating a virtual directory it was possible to set the virtual directory to actually add as a redirect to another page or site.  In IIS7 this is still possible however it needs to be achieved slightly differently.  Lets take an example.  Say you have a website and you are running a number of offers and would like to offer users the option of navigating to them through a short path such as domain/offer1, domain/offer2 etc then you would have in IIS6 set these Virtual Directories up with dummy Physical Paths, e.g. the root of the parent site, and set the option to redirect to a URL.

In IIS7 because the configuration is stored in a web.config file in the physical path of the virtual directory, this can cause the redirections to be overwritten, i.e. if you set up the redirection of domain/offer1 to go to domain/offers/offer1 and then go and set up domain/offer2 to go to domain/offers/offer2 you will find that both redirections go to domain/offers/offer2 because the value in the web.config file has been overwritten by the second redirect rule.  In order to achieve the desired effect and get the redirections to work, you need to actually add the redirections to the applicationhost.config file and set a location tag for the site you are working in.  This is currently not possible in the User Interface but is possible to achieve using the APPCMD utility.  Here are the steps to achieve this.

1. Open an elevated command prompt

2. then run the following command –

%windir%\system32\inetsrv\appcmd set config "nameofsite/virtualdirectoryname" -section:system.webServer/httpRedirect -enabled:true -destination:destinationofredirect -commitpath:apphost

an example of this command would be:

c:\windows\system32\inetsrv\appcmd set config "Default Web Site/offer1" -section:system.webServer/httpRedirect -enabled:true -destination:Offers/Offer1/default.aspx" -commitpath:apphost

 

The key element here in this command is the commitpath directive which adds sets the configuration in the applicationhost.config:

<location path="Default Web Site/Offer1">
  <system.webServer>
    <httpRedirect enabled="true" destination="Offers/Offer1/default.aspx" />"
  </system.webServer>
</location>

 

Hope this clears it up :).

Girl Geek Dinners – Manchester 25th July and Leeds 13th August

Girl Geek Dinners I’ve got a number of blog posts in the pipeline waiting to be finished but this one is more urgent the others, as the subject contains something which is happening tomorrow night in Manchester! The second Manchester Girl Geek Dinner will be held tomorrow night, 25th July 2008 at the University of Salford. Looks like some excellent talks lined up, especially Gemma’s session on how to engage young people in Geekery – I managed to capture the imagination of a female work experience student for a couple of hours last week but how can we maintain it is my question, especially as I feel the curriculum for Key Stage 2 upwards is very poor in IT.  For more details and to register please go to -  http://www.manchestergirlgeekdinners.co.uk/email/registration.php and here are some details Gemma sent through:

When: 25th July 7pm
Where: Salford University, University House
Who can attend: Girl Geeks! A lady who has an interest, or is involved in the Science, Engineering and Technology industries. Blokes can come too, but you need an invite from a Geek Girl.
Cost: Around ÂŁ15
What:
For those who haven’t been before, it’s dinner, wine, talks from inspirational women, networking and discussions afterwards.
Dress up as much as you like, for those of us who like to wear pretty dresses (I am!), or if you’re more comfortable in jeans that’s fine too.
Currently we have two talks planned, if you want to get involved and speak about women in engineering, science and technology, please do get in touch.
The talks:
Gemma Cameron – How to get young people interested in Geekery!
Rachael Hoyle – winner of the Advanced Apprentice of Year Award. Rachael will be delivering an extremely interesting talk around the stigma of women in engineering. This will cover how ethics and equality are the dominant factors in employment, and whether this is damaging the industry, rather than encouraging diversity.
Links:
www.manchestergirlgeekdinners.co.uk
http://upcoming.yahoo.com/event/859931
http://www.facebook.com/event.php?eid=22778411401

Girl Geek Dinners - Leeds 13/08/2008 In addition to this great event, I was reading a post on the Girly Geekdom Blog which was advertising the first Girl Geek Dinner in the North East – well Leeds is almost the North East :p.  More importantly the Dinner is being held on 13th August at The Study @ The Living Room on Greek Street, Leeds.  Confirmed speakers include Lydia Machell, a Freelance Music Software Developer and Lorna Mitchell a Developer, Consultant and Trainer for iBuildings in Leeds.  For more information and to register for this event please view the Blog post – http://girlygeekdom.blogspot.com/2008/07/girl-geeks-to-make-some-noise-in-north.html

It’s great to see the Girl Geek Dinners this side of the M25 and I hope this is the first of many more events in both localities.

Awarded Microsoft MVP Award for IIS!

This afternoon I received an email from Microsoft telling me that I’ve been awarded the 2008 Microsoft MVP award for my efforts in the Internet Information Services Community over the past year.  This is a great honour to be classified in the same group as the many other great MVPs who do great work throughout the community.  I hope I can continue in the same way in the coming months and years.