find the maximun are of rectangle if his points are O(0,0) A (x,0) C(0,y) and B is in the graph of function

i tried this way:

S= x * y = x * e^(-x)

then i found the first derivative, then found the point wich the funcion has extremum (x=1) then i found the second derivative and pluged the extrem point x=1 into the function witch was now <0

now the maximum area is S=1*e^(-1)

am i right ? if isn't how should i solve this ?