[英]Url Rewriting ASP.NET - Some images refuse to load
I have recently implemented UrlRewriter (http://urlrewriter.net) on my website and am having some issues. 我最近在我的网站上实现了UrlRewriter(http://urlrewriter.net),并且遇到了一些问题。
I am implementing it so the page requests are extension-less. 我正在实现它,因此页面请求是无扩展名的。 For example,
www.example.com/my-cool-product
, redirects to www.example.com/Product.aspx?id=1
. 例如,
www.example.com/my-cool-product
,重定向到www.example.com/Product.aspx?id=1
。 This works fine. 这很好。
The problem I am having is that, some of my site images are refusing to be served as static content. 我遇到的问题是,我的某些站点图像拒绝用作静态内容。 If I put the path to some of images on my site, they are served up right away (as static content), but some images try to route through the .NET pipeline.
如果在我的站点上放置一些图像的路径,则会立即提供它们(作为静态内容),但是有些图像会尝试通过.NET管道进行路由。
For example, www.example.com/Asset/Image/Image.png
returns a 404 as it is trying to hit up www.example.com/Asset/Image/Default.aspx
. 例如,
www.example.com/Asset/Image/Image.png
返回404,因为它试图撞了上去www.example.com/Asset/Image/Default.aspx
。
Can anyone shed any light on why this is happening for some images and not for others? 谁能阐明为什么某些图像而不是其他图像会发生这种情况?
What version of IIS are you using? 您正在使用哪个版本的IIS? You may need:
你可能需要:
<modules runAllManagedModulesForAllRequests="true">
In your web.config <system.webServer>
block 在您的web.config
<system.webServer>
块中
Or set a <base>
url in your page head 或在页面标题中设置
<base>
网址
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.