【问题标题】:IIS Redirect with appcmd causing recursive redirectIIS 重定向与 appcmd 导致递归重定向
【发布时间】:2012-09-07 10:05:59
【问题描述】:

我正在尝试使用 appcmd.exe 和以下命令设置相对重定向:

appcmd.exe set config "Website" -section:system.webServer/httpRedirect /enabled:"True" /destination:"/Login/UnderConstruction.aspx" /httpResponseStatus:"Found"

“网站”的绑定为"http://localhost:81"

但是这似乎导致了递归重定向,因为当我访问localhost:81时,会生成以下路径:

http://localhost:81/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/Login/UnderConstruction.aspx/

我在谷歌上搜索过这个,但我找不到有同样问题的人。有没有办法将所有站点请求重定向到相对于该站点的路径而不会导致递归重定向?

【问题讨论】:

    标签: asp.net redirect iis-7 recursion appcmd


    【解决方案1】:

    我已经在 httpredirect 中使用通配符解决了这个问题

    例如,以下脚本有效:

    appcmd.exe set config "Website" -section:system.webServer/httpRedirect /+"[wildcard='*.aspx',destination='/Login/UnderConstruction.aspx']" /destination:"" /enabled:"True" /exactDestination:"False" /childOnly:"False"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-19
      • 1970-01-01
      • 1970-01-01
      • 2021-06-13
      • 2023-03-10
      • 2021-07-02
      • 2015-11-09
      相关资源
      最近更新 更多