I'm trying to create a handler to intercept index.cfm files, as we're migrating from an old ColdFusion system to Sitecore. I've designated the handler like this:
<system.webServer>
<handlers>
<add verb="*" path="index.cfm" type="Foundation.Core.Pipelines.LegacyItemResolver, Foundation.Core" name="Foundation.Core.Pipelines.LegacyItemResolver" xdt:Locator="Match(path)" xdt:Transform="InsertIfMissing" />
</handlers>
</system.webServer>
Then my class definition is this, working off the modeling I see for the MediaRequestHandler in dotPeek:
namespace Foundation.Core.Pipelines
{
public class LegacyItemResolver : IHttpHandler, System.Web.SessionState.IRequiresSessionState {
public void ProcessRequest(HttpContext context)
{
SiteContext site = Sitecore.Context.Site;
}
public bool IsReusable => true;
}
}
The call fires in the debugger, but the Sitecore.Context comes back as null. I added the session state inherit because someone suggested it would enable the Sitecore.Context, but that's not happening. I figure I need to use the handler via web.config to register the index.cfm name/type in IIS, but I need to access the Sitecore context so I can take an ID parameter and do a search for the legacy ID and redirect the user to the correct URL in Sitecore.
What's the best way to get access to the Sitecore context at this point?