Running a wifi shield and a extra SD module in an arduino mega 2560?

Hello dear arduino community.... After some tests my problem has been reduced in the next question, I need to run a wifi shield + an extra SD module in my arduino mega 2560. I tried a simple code that writes data on the sd card using just the arduino mega and the sd module but when I connect the wifi shield (for later purposes) the same simple code does not work.... I imagine that it is just a simple thing I have to do, could you please help me? Regards Sebastian

Since the SD card and WiFi Shield both use the SPI bus my first guess would be a pin conflict between the two. I think the WiFi Shield uses Pin 10 for SlaveSelect. What pin is your SD card module using? I would recommend Pin 4 since that is what the SD card connector on the Ethernet shield uses.