我目前在我的网站上使用URL重写。
如果URL为www.mywebsite.com/orders/Default.aspx?id=100
它将Url设置为www.mywebsite.com/orders/100
如果有人试图破解URL并输入未知值,我将重定向到主页
现在我需要的是,如果有人试图破解网址并添加扩展名,如.aspx,.jsp,.html,.html,....
例如:www.mywebsite.com/orders/100.aspx (Hack之后)。
我想删除这些扩展名,并将查询字符串仅用作www.mywebsite.com/orders/100并处理它。
我在StackOverflow中看到了这种类型的行为。
我能做到这一点吗?如果是,如何?
发布于 2012-11-09 15:18:08
类似于您必须在web配置文件中配置的内容
<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>此链接摘自以下链接
https://stackoverflow.com/questions/13303475
复制相似问题