I implemented this HttpHandler using IIS 7 and .NET 2.0 to restrict access to certain requests to our server:
using System;
using System.Web;
public class HtmlHandler : IHttpHandler
{
public bool IsReusable
{
get
{
return true;
}
}
public void ProcessRequest (HttpContext context)
{
if(!context.Request.IsAuthenticated)
context.Response.Redirect("/inc/logout.asp");
}
}
I set it up in IIS like so:
At first, it seems to work. It redirects me to the login page if the request isn't authenticated when trying to access .html files.
The problem is, that when I do log in and try to access the page, it just returns a blank page. Nothing but html, head, and body tags.
What am I doing wrong?