IIS 7 no images when friendly url is on

811 views Asked by At

I am using two simple rules to realize friendly url.

They are working find but I cannot see images and there is an error

Friednly URL of ASP.NET 3.5 Website

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

Error

http://localhost/Test/Products/888/Images/Jellyfish.jpg Failed to load resource: the server responded with a status of 404 (Not Found)

Rules

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

I see that IIS is building wrong path to images like it says

http://localhost/Test/Products/888/Images/Jellyfish.jpg

Any clue?

1

There are 1 answers

0
NoWar On BEST ANSWER

Finally I found the answer here Missing CSS file and images after URL rewrite

We have to use in MasterPage's header this line

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

You can read about it here http://www.w3schools.com/tags/tag_base.asp