Problems using ethernet and SD card

The sketch started off with the right line 'if (!SD.begin(chipSelect)) {... but that did not work!!!
even forcing the chip selects on and off, which ought to be handled by <Ethernet.h> and <SD.h>.

Once the two interfaces are set up, the libraries do handle the SS pins. You do not need to manipulate the SS pins after both begin() functions are complete. It is up to you to avoid data collisions on the SPI bus until then.

edit: Does this work for you?

#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

void setup() {
  Serial.begin(9600);

  // disable w5100 while setting up SD
  pinMode(10,OUTPUT);
  digitalWrite(10,HIGH);

  Serial.print("Initializing SD card...");
  if (!SD.begin(4)) Serial.println("failed");
  else Serial.println("OK");
  // the SD.begin(4) function returns with its SPI disabled, so nothing needs to be done

  // set up w5100 with dhcp
  Serial.print("Initializing ethernet...");
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println("ok");

  // the Ethernet.begin(mac) function returns with its SPI enabled, so disable it
  digitalWrite(10,HIGH);
}

void loop() {
}