MVC ashx handler
I'm using MVC3 and want to create a route to an ashx file. I've created an Generic Handler with this code in:
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
var handler = new TileHandler();
handler.ProcessRequest(requestContext);
return handler;
}
I've set a route up in the Global.asax which works fine. However my TileHandler which is an ashx page expects a HttpContext to be pa开发者_C百科ssed to it not a RequestContext. I can overload the method, but it obviously still wants the standard method invoked on call.
My question is therefore how can you use an ashx page passing in a RequestContext object?
Thanks in advance.
Change your TileHandler to inherit from System.Web.Mvc.MvcHandler
instead.
Example.
精彩评论