且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP.Net-由编码的URL引起的路径问题

更新时间:2022-12-03 09:06:05

好吧,我进一步看了一下-实际上,〜"似乎是问题所在.

Well I looked a little further into it-- The "~" actually seems to be where the problem is occurring.

链接正常工作,但我认为服务器在生成相对路径时无法正确解析它...

The links are working correctly but I think the server isn't parsing it correctly when it generates the relative paths...

这是工作链接上生成的代码中的css链接

../../CSS/Layout.css

以下是残破页面上具有相同深度的css链接

../../../CSS/Layout.css"

这是一个非常丑陋的修补程序,可以解决-不确定是否有更好的方法

Here is a very ugly fix that works- not sure if there is a better way though

<link rel="stylesheet" type="text/css" href="<%=Request.ApplicationPath+"/Css/Layout.css" %>" />

奇怪的是,从站点地图中类似路径生成的导航链接工作正常.也许当它从站点地图生成路径并且不尝试构建相对路径时,它会更好地理解整个层次.

The strange thing is that the navigation links generated from similar paths in the sitemap are working fine. Maybe it understands the full hierchy better when it is generating paths from the site-map and doesn't try to build a relative path.