Used the as-operator to prevent a possible failing cast to break the debugger

Using the as-operator to test the dynamic type befor trying to cast it
to the Response type. In this way, no exception is thrown if the type is
not correct. The cast is still used in order to get the cast overloads
called correctly.