开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜