Pregunta

I'm trying to set a relative redirect using appcmd.exe with the following command:

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

"Website" has a binding of "http://localhost:81"

However this seems to be causing a recursive redirect, because when I visit localhost:81, the following path is generated:

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/

I have searched for this on google but I can't find anyone with the same issue. Is there a way to redirect all site requests to a path relative to that site without causing a recursive redirect?

¿Fue útil?

Solución

I have resolved this using wildcards within the httpredirect

For example, the following script works:

appcmd.exe set config "Website" -section:system.webServer/httpRedirect /+"[wildcard='*.aspx',destination='/Login/UnderConstruction.aspx']" /destination:"" /enabled:"True" /exactDestination:"False" /childOnly:"False"
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top