Killer Shrike
02-26-2007, 08:13 AM
I moved my website over to this host this weekend. I used a lot of SHTML on my previous host, but it was easy to write a little console app to roll thru my site and remap / relink to .aspx instead. Thats all working, no problems.
However, there are hundreds of links scattered all over the place onexternal sitesto my shtml pages and I'd like to redirect them gracefully.
So, Ive added a simple HTTP handler like so:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace KillerShrike
{
public class ShtmlHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.Redirect(context.Request.RawUrl.R eplace(".shtml",".aspx"));
}
public bool IsReusable
{
get { return true; }
}
}
}
and Ive added this node to thehttpHandlers groupinmy web.config:
<add verb="*"
path="*.shtml"
type="KillerShrike.ShtmlHandler, KillerShrike" />
Works perfectly when I run it locally.
So, in the IIS manager in the site controls I added .shtml as a MIME type. I tried every single mime type I could think of ranging from text/html to application/octet-stream and i still get the IIS 404 error.
What I would expect to happen is for IIS to use the custom MIME type to let .shtml pass thru and then the httpHandler would jump on it and resolve it correctly as it does locally.
Any ideas whats going wrong here?
Thanks!
However, there are hundreds of links scattered all over the place onexternal sitesto my shtml pages and I'd like to redirect them gracefully.
So, Ive added a simple HTTP handler like so:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
namespace KillerShrike
{
public class ShtmlHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.Redirect(context.Request.RawUrl.R eplace(".shtml",".aspx"));
}
public bool IsReusable
{
get { return true; }
}
}
}
and Ive added this node to thehttpHandlers groupinmy web.config:
<add verb="*"
path="*.shtml"
type="KillerShrike.ShtmlHandler, KillerShrike" />
Works perfectly when I run it locally.
So, in the IIS manager in the site controls I added .shtml as a MIME type. I tried every single mime type I could think of ranging from text/html to application/octet-stream and i still get the IIS 404 error.
What I would expect to happen is for IIS to use the custom MIME type to let .shtml pass thru and then the httpHandler would jump on it and resolve it correctly as it does locally.
Any ideas whats going wrong here?
Thanks!