asp.net webapi working with environment variables

I am using asp.net 4.5. I am trying to get an appsetting variable based on environment. How can I check what environment I am running?

    public virtual string GetConnectionString()
    {
        var connString = "";
        //if dev environment
          connString = ConfigurationManager.AppSettings["ConnStringTest"];
        //else if check for prod
         ...

        return connSring;
    }

Or is there a better way to do this?