Enabling and configuring Http-Redirection on IIS 7

There is always a use case or a scenario where one might want to redirect all request from your website to some other website. The element configures settings for Internet Information Services (IIS) 7 that redirect client requests to a new location.

To begin with, make sure you have HttpRedirect feature enabled, if not it can be easily be enabled by going to the “Programs & Features” >> “Turn Windows features on or off” and enabling “HTTP Redirection” module.

enter image description here

Once you have made sure you have the necessary module installed. Let’s quickly see how to setup the redirection.

enter image description here

enter image description here

Simply put in the url where you want the redirection to happen. You can also redirect to the exact destination instead of relative using the options provided.

Hope this helps. Cheers!

Prevent elmah to be cached when using CDN.

It has been a common practice to use ELMAH for pretty much all of my web projects built using the ASP.NET stack.

One problem I kept running into was when using CDN with a website, there was no simple/direct way to tell the CDN to not cache the elmah urls. Here’s a solution which worked for me.

Step 1: Select website and add a url rewrite rule

Step 2: Make sure to select the “Outbound” rule when selecting the rule template

Step 3: Add a precondition, in this case add the elmah url

Step 4: Add a rule to update your response header’s Cache-Control with no-cache

Step 5: Done, now check the http response on your browser