I believe I have identified my problem. Running locally, the base address was just http://localhost:64133/
. So all of my redirects were working as they were using relative paths e.g. http://localhost:64133/staticcontent/pagenotfound
However, when I deployed to my dev server in our dev environment, the path of the base directory was slightly different because the IIS application was inside a folder called WebRequest, which was sitting inside of wwwroot (in C:\inetpub).
This meant that the base URL for the application was http://servername/WebRequest/
. And so my redirects were sending it to http://servername/staticcontent/pagenotfound
, instead of http://servername/WebRequest/staticcontent/pagenotfound
.
Sorry about that folks. That would have been very difficult for you guys to help, not knowing that environmental foible. I guess we can all learn from that one. Thanks again.