Search code examples
web-applicationsproduction

way to warn developers they are on Production site


We have a web app deployed in several environments (Dev, QA, etc.) as well as Production. Ironically enough, the non-production sites have prominent markings saying what environment it is, but Production does not (for obvious reasons). The danger is that a developer will do something on production thinking that they are in some other environment. Of course, self-discipline is your friend here (close Prod as soon as you're done) but is there anything systematic we can put in place to help us out that will not affect the user experience in Prod?


Solution

  • .NET

    Check the requester's IP address and see if it falls within your private subnet.

    if (Request.UserHostAddress.StartsWith("192.168.1."))
    {
        // show control
    }