1

I'm currently using URL Rewriting in my website.

If the URL is www.mywebsite.com/orders/Default.aspx?id=100

It makes the Url as www.mywebsite.com/orders/100

If some one tries to hack the URL and enter unknown values I redirect to Home page

Now what I need is, If some one try to hack the URL and add extensions like .aspx,.jsp,.html,.html, ....

for ex: www.mywebsite.com/orders/100.aspx (After Hack).

I want to remove those extensions and take the query string as www.mywebsite.com/orders/100 only and process it.

I saw this type of behavior in StackOverflow.

Can I achieve this? If YES How ???

Krishna Thota
  • 6,646
  • 14
  • 54
  • 79

1 Answers1

0

Something like you have to configure in the web config file

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

This was taken from following links

Remove HTML or ASPX Extension

Community
  • 1
  • 1
Thangamani Palanisamy
  • 5,152
  • 4
  • 32
  • 39