F ound the solution myself.
Had to add the csv extension in the ashx file as well along with the controller.
It is working now.