Im trying to write a small web application for forwarding requests to my page to the new pages on my web site. First off im implementing a IHttpHandler and in the ProcessRequest method i simple want to print out the requesting page, my conde looks like this:
public class RedirectHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write(context.Request.Path);
}
}
I have registered in the web.config and have a problem with testing the handler. I start it through visual studio, it is just listing my files. I then from a browser request a file, and expects to see the name in the browser, but an exception that the page is not found is thrown. I have deleted all other .aspx page so the only “page” i have is my http handler. Could anyone point me in the right direction?
Edit
Configuration settings (web.config)
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<add name="RedirectHandler" resourceType="Unspecified" verb="*" path="*.html" type="Jeeves.RedirectHandler"/>
</handlers>
</system.webServer>
The entries in the system.webServer/handlers configuration element are only effective if you are running IIS 7 (in Integrated mode). Either specify Use Local IIS Web Server in the Web section of the project’s properties (if you have IIS7) or use the system.web/httpHandlers element instead: