-1

I am using following web.config entry for url rewriting to remove .aspx extension.

<rewrite url="~/(.+)" to="~/$1.aspx" />

The problem I am getting here is if I have any image on page, it assigns .aspx extension to image. Also if I tried to access my site like http://exmaple.com, it get redirected to http://exmaple.com/default.aspx.aspx.

I want to know if there is any way to add ignore case in web.config.

4

1 回答 1

0

您的重写应该看起来像这样,以删除 .aspx

<rewrite>
    <rules>
        <rule name="RewriteASPX">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="{R:1}.aspx" />
        </rule>
    </rules>
</rewrite>
于 2012-09-24T16:19:31.887 回答