The issue here is your use of the is operator to check the equality of the strings. The is operator checks if its two arguments refer to the same object, which is not the behavior you want here. To check if the strings are equal, use the equality operator: