I'm looking to create a status page for each of our applications, that returns a bit of information about the application. Version, database connectivity, etc. I've decided to try to implement this as an http handler that can be dropped into all of our apps. Some webforms, some MVC, some Angular/WebAPI. Using .net Framework 4.7.2. In theory, when a user requests domain.com/appname/anything.status the application should pass through the StatusHandler class I've created. But when I make a request, i'm getting a 404.

The handler exists in a dll named StatusFramework:

using System;
using System.Web;

namespace StatusFramework
{
    public class StatusHandler : IHttpHandler
    {

        #region IHttpHandler Members

        public bool IsReusable
        {
            // Return false in case your Managed Handler cannot be reused for another request.
            // Usually this would be false in case you have some state information preserved per request.
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            //write your handler implementation here.

            context.Response.Write("Hello from handler!");
        }

        #endregion
    }
}

The main application has the StatusFramework dll added as a reference and i've modified the web.config to include the following in the handlers section:

<add name="StatusHandler" path="*.status" verb="*" type="StatusFramework.StatusHandler, StatusFramework"/>

I seem to be having a hard time finding a modern tutorial for HTTP Handlers, so I'm not totally sure if this is a good way to go about doing this. Open to suggestions on alternate ways to accomplish this if that makes the most sense. Any help with a solution to my problem is appreciated.

0 Answers