3

Is there a way to display custom errors on specific host(s) (eg: www.example.com) and display vanilla errors on others (eg: beta.example.com)?

I'm thinking along the lines of configuration syntax that can be added to the customErrors section of the web.config.

It's actually for MVC 3, if that makes any difference.

The sites are hosted on separate servers. http://beta.yogaloft.co.uk/ is built and deployed automatically by appharbor and promoted to http://www.yogaloft.co.uk/ whenever it's ready for the wild.

VMAtm
  • 27,943
  • 17
  • 79
  • 125
grenade
  • 31,451
  • 23
  • 97
  • 126

2 Answers2

2

what i would do is use customized HandleErrorAttribute to detect the request and show the custom error on the www.example.com ?

basically, extend the HandleErrorAttribute ( HandleCustomErrorAttribute : HandleErrorAttribute )and put the logic to detect if the request is coming from example.com and if so show a specified view.

I have not tried it this way, but shouldnt be impossible.

Illuminati
  • 4,539
  • 2
  • 35
  • 55
1

If this hosts are set on the same directory, you can't. All you can do - use the customErrors="RemoteOnly" setting and beta test locally. You really should use two different sites for the production and testing.

VMAtm
  • 27,943
  • 17
  • 79
  • 125