0
我有一个url,/example/index.html
,当命中时,我需要重定向到/
,页面的根。在asp.net中的404触发器之前重定向一个特定的url web.config
麻烦的是,这个页面实际上并不存在,所以我只是得到一个404代替。 如果可能,我想在web.config文件中执行此操作。这是我有:
<location path="example/index.html">
<system.webServer>
<httpRedirect enabled="true" destination="/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
但它似乎是404处理首先触发。有任何想法吗?
你不使用mvc控制器吗? –
@KarthikMR我们有控制器,是的,但如果他们想稍后改变它,在配置中更容易。 – ptf
删除位置标记并尝试使用 httpRedirect> –