Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 启用友好url时,IIS 7没有图像_Asp.net_Iis 7_Friendly Url_Url Rewrite Module - Fatal编程技术网

Asp.net 启用友好url时,IIS 7没有图像

Asp.net 启用友好url时,IIS 7没有图像,asp.net,iis-7,friendly-url,url-rewrite-module,Asp.net,Iis 7,Friendly Url,Url Rewrite Module,我使用两个简单的规则来实现友好的url 他们正在查找,但我看不到图像,并且出现了错误 ASP.NET 3.5网站的唯一URL http://localhost/Test/Products/888/9999 错误 加载失败 资源:服务器响应状态为404(未找到) 规则 <rule name="t2" enabled="true"> <match url="^products/([0-9]+)/([0-9]+)" negate="fal

我使用两个简单的规则来实现友好的url

他们正在查找,但我看不到图像,并且出现了错误

ASP.NET 3.5网站的唯一URL

http://localhost/Test/Products/888/9999
错误

加载失败 资源:服务器响应状态为404(未找到)

规则

  <rule name="t2" enabled="true">
                    <match url="^products/([0-9]+)/([0-9]+)" negate="false" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Rewrite" url="products.aspx?p={R:1}&amp;pc={R:2}" />
                </rule>
                <rule name="t1" enabled="true">
                    <match url="^product/([0-9]+)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
                    <action type="Rewrite" url="product.aspx?p={R:1}" />
                </rule>


有什么线索吗?

我终于在这里找到了答案

我们必须在母版的页眉中使用这一行

<base href="//your.domain.here" />


你可以在这里读到它

我不完全明白。除了url
http://localhost/Test/Products/888/9999
返回位置的图像
http://localhost/Test/Products/888/Images/Jellyfish.jpg
,或者您的product.aspx返回图像。你想要得到的图像的真实url是什么?@PeterHahndorf-the-url
http://localhost/Test/Products/888/9999
打开Products.aspx。但不知怎的,IIS正在重写此页面内图像的路径。此页面有一个简单的“``可以正常工作,无需重写规则。因此,图像的src与页面相关,浏览器将请求类似于“`”的内容,这是由您的重写规则获取的。在F12浏览器工具中,检查图像的实际请求url。您必须从规则中排除图像,或者使用非相对路径。@PeterHahndorf我该怎么做?您可以在规则中添加一个条件,如
,或者
,您必须确保图像与规则不匹配。