I have a library that exposes some request processing functionality using IHttpHandler. I looked, but can't find any information on how to use the new ASP.NET 5 CoreCLR (not the full 4.5 framework) to reimplement this functionality.
Let's say the handler is as simple as the one below.
public class TestHttpHandler :IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/html";
context.Response.Write("<html><h1>Hello world!</h1></html>");
}
}
Note that I'm actually interested only in making this library truly portable (System.Web doesn't work for profile 259, which my library needs to target), so I want to know what to subclass or implement in order to get this to process requests when run using the CoreCLR.
In Asp.Net 5 (ASP.NET Core) the Middleware is the replacement for HttpModule/HttpHandler. If you want to implement your middlewares in a class library you have to use the asp.net class library which supports multi framework targeting like .net core.
Learn about Middleware: