Asp.net Mvc3 Url重写 不存在的目录时的配置

<RewriterRule>
<LookFor>~/(\d+)</LookFor>
<SendTo>~/Home/index?id=$1</SendTo>
</RewriterRule>

 

一定要注意重写目录首页时,要带上index,IIS重写时不写识别如下配置:

<RewriterRule>
<LookFor>~/(\d+)</LookFor>
<SendTo>~/Home?id=$1</SendTo>
</RewriterRule>

你可能感兴趣的:(asp.net)