I did a bit of search but can't find a complete answer to my question: I wonder if it's possible to set my IIS 7.5 to map one "custom" extension to another "physical" extension.

Eg. I have Default.aspx, I'd like my server to serve this file to a request of Default.foo.

The mapping questions/answers I found are all about having Default.foo files, and mapping them to the proper handler; that's not my case, I just like to have a sort of masking of the real physical file extension.

Is it possible?

TY

有帮助吗?

解决方案

The mapping should be setup between default.foo and default.aspx, mapping extensions cannot achieve this goal. You may use URL Rewrite module to create a rule to rewrite default.foo to default.aspx.

A simple example is as below,

<rewrite>
        <rules>
            <rule name="foo" stopProcessing="true">
                <match url="(.*)\.foo" />
                <action type="Rewrite" url="{R:1}.aspx" />
            </rule>
        </rules>
    </rewrite>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top