开发者

wildcarded httphandler with mvc no longer working

I have this

      &开发者_StackOverflow社区lt;add name="xxx" verb="GET,POST,PUT" path="xxx/*" type="...." />

Ie any url that looks like xxx/anything should go to that handler. Now that this is cohosted in an MVC app it no longer works. It seems that I need some derivative of

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

but I cannot work out the correct incantation


has to be

public class XXXRouteHandler : IRouteHandler
{
    public IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
        return new XxxHandler(); // the original http handler
    }
}

and

     var xxxroute = new Route("xxx/{*pathinfo}", new XXXRouteHAndler());
     routes.Add(xxxroute);

in RegisterRoutes

Correction: better is

            routes.IgnoreRoute("xxx/{*ignore}");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜