c#
  • asp.net
  • url-routing
  • ashx
  • absolute-path
  • 2011-05-27 111 views 2 likes 
    2

    我在我的全球网站中有route.Ignore("{resource}.axd/{*pathInfo}");。使用RESOLVEURL林如何在实现Url路由后修复路径(ASP.NET 4.0 webforms)

    在我指向我的.js和.css文件

    我的所有的链接都与GetRouteUrl

    我的图片中没有正在生成。我所有的图片是从“ResizeHandler” ashx的文件: <img src='ResizeHandler.ashx?file={0}&width=320&height=160' />

    难道我莫名其妙地忽略.ashx的文件在我的全球航线服务,还是我以某种方式使用使用Server.Mappath,PhysicalApplicationPath或其他什么东西?什么是最佳解决方案?我试过src="/ResizeHa...(注意“/”) - 不起作用。它将项目文件夹跳回到localhost:666/ResizeHandler.ashx。

    -Thanks

    回答

    2

    在Global.asax文件中,我把这个:

    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 ! 
    } 
    

    工作的罚款,我以我个人的经验;我希望你也一样。

    相关问题