开发者

How do I fix paths after implementing Url-routing (ASP.NET 4.0 webforms)

I have route.Ignore("{resource}.axd/{*pathInfo}"); in my global.

Im using ResolveUrl in my to point to my .js and .css files

All my links are generated with GetRouteUrl

BUT

None of my images are working. All my images is from a "ResizeHandler" .ashx file: <i开发者_如何学Gomg src='ResizeHandler.ashx?file={0}&width=320&height=160' />

Do I somehow ignore .ashx files in my global routes, or do I somehow use Server.MapPath, PhysicalApplicationPath or something else? What the best solution? Ive tried src="/ResizeHa... (note the "/") - doesnt work. It skips the project folder back to localhost:666/ResizeHandler.ashx.

-Thanks


in the Global.asax file I put this:

void RegisterRoutes(System.Web.Routing.RouteCollection routes)
{
    routes.Ignore("{resource}.axd/{*pathInfo}");
    routes.Ignore("{resource}.ashx/{*pathInfo}");

    // Register a route for someurl/{somename}
    // Other code here !
}

Work's fine for me in my personal experience; I hope the same for you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜