More in this section

Forums / Bugs & Issues / Extensionless URLs, URL Rewriting and IIS6 vs IIS7

Extensionless URLs, URL Rewriting and IIS6 vs IIS7

3 posts, 0 answered
  1. Jacques
    Jacques avatar
    427 posts
    28 Jun 2007
    11 Mar 2011
    Link to this post
    Guys, another person in our office has tried in this thread,
    to sort out the problem with extensionless URLs and URL Rewriting in IIS7.

    We have now tried everything you suggested and nothing seems to be working.

    1) The site we're building uses extensionless URLs across the board
    2) The site we're building uses URL rewriting to deal with property searches where a URL such as should be rewritten as
    3) We've configured the advanced URL rewriter and added a valid rewrite rule (proven tested, the works)
    4) We've configured the sf404.aspx customError and removed the aspx extension from the <cms node in the web.config file and in IIS

    In IIS 6 this configuration and setup works perfectly!
    In IIS 7 the extensionless URLs works, but when we try to go to the property search URLs as mentioned in point 2 above we get the following result:
    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

    Requested URL: /sf404.aspx

    We have tried a number of different solutions to this problem and we're not getting anywhere. We've even tried to add the wildcard handler using .net 2.0x in IIS7 and NOTHING.

    How is it possible that this works in IIS6 but not in IIS7.

    Our project was supposed to be up for demonstration purposes today and it's been weeks since we started this conversation on these forums.

    How do we sort this out properly?

  2. Jacques
    Jacques avatar
    427 posts
    28 Jun 2007
    12 Mar 2011
    Link to this post
    We eventually managed to find out what's going on but it's nothing that we expected and is not easily explained by anyone at our office.

    1. We got the extensionless URLs to work following the 3.7 documentation (which has one or two missing points)
    2. We then switched the URL rewrites back on which failed. (baring in mind this worked perfectly in IIS6)

    We eventually found that the regular expressions that worked for IIS 6 as follows:
    02.      <rule>
    03.        <url>
    04.          <![CDATA[http://([^\/]*)\/property-for-sale(.*)]]>
    05.        </url>
    06.        <rewrite>http://$1/property-search-results?location=$2</rewrite>
    07.      </rule>
    did not work for IIS 7. We can't explain why. <urlrewrites>
    In the end we changed the regular expressions to the following:      
    2.      <rule>
    3.        <url>
    4.          <![CDATA[\/property-for-sale(.*)]]>
    5.        </url>
    6.        <rewrite>/property-search-results?location=$2</rewrite>
    7.      </rule>

    This worked for IIS6 and IIS7 on Windows XP, 7 and Server 2008. Having said that, the regular expressions in use is based on .net and each environment was using .net 2.0 (application is 3.5) so there should be no difference in regular expressions implementation.

    That leaves the question: Where did it go wrong?

    Anyone ever find an answer to this we would appreciate the feedback.

  3. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    01 Feb 2016
    17 Mar 2011
    Link to this post
    Hi J.Hoventer,

    The regular expressions are matched to the raw url, which starts after the domain name and will not match regular epxressions if you start them with http://

    All the best,
    Radoslav Georgiev
    the Telerik team
Register for webinar
3 posts, 0 answered