Problems for getting SD card info

Hi!!

This is my first post. I’ve been looking for information in this forum but I didn`t find anything similar.

I’m trying to do a project to control a solenoidvalve with an html webserver stored in an SD card. The problem is that until now it has been impossible for me to read the card, and I’m starting to think that for some reasons the ethernet shield doesn`t read correctly the card. This is the code I’ve been using for doing it:

#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>

//Configuración inicial placa ethernet
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);
EthernetServer server(85);

File file; 
int vv=6; //Pin relé
String estado="OFF"; //Estado inicial del relé


void setup()
{
    Ethernet.begin(mac, ip);  // initialize Ethernet device
    server.begin();           // start to listen for clients
    Serial.begin(9600);       // for debugging
    
    // initialize SD card
    Serial.println("Initializing SD card...");
    pinMode(10, OUTPUT);
    
    
    if (!SD.begin(4)) {
        Serial.println("ERROR - SD card initialization failed!");
        return;    // init failed
    }
    Serial.println("SUCCESS - SD card initialized.");
    // check for index.htm file
    if (!SD.exists("index.htm")) {
        Serial.println("ERROR - Can't find index.htm file!");
        return;  // can't find index file
    }
    Serial.println("SUCCESS - Found index.htm file.");
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    String cadena=""; //Creamos una cadena de caracteres vacía
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        cadena.concat(c);//Unimos el String 'cadena' con la petición HTTP (c). De esta manera convertimos la petición HTTP a un String
        
         //Ya que hemos convertido la petición HTTP a una cadena de caracteres, ahora podremos buscar partes del texto.
         int posicion=cadena.indexOf("vv="); //Guardamos la posición de la instancia "vv=" a la variable 'posicion'
 
          if(cadena.substring(posicion)=="vv=ON")//Si a la posición 'posicion' hay "vv=ON"
          {
            digitalWrite(vv,HIGH);
            estado="ON";
          }
          if(cadena.substring(posicion)=="vv=OFF")//Si a la posición 'posicion' hay "vv=OFF"
          {
            digitalWrite(vv,LOW);
            estado="OFF";
          }
 
        //Cuando reciba una línea en blanco, quiere decir que la petición HTTP ha acabado y el servidor Web está listo para enviar una respuesta
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          
          // Here we open the webpage. The example file is called inde.htm .
              file = SD.open("index.htm");        // open web page file
                    if (file) {
                        while(file.available()) {
                            client.write(file.read()); // send web page to client
                        }
                        file.close();
                    }
                    else {
                      Serial.println("error opening index.htm");
                    } 
                    break;
                }
         
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

Now I’m trying to check the card using an example code of Arduino called CardInfo, but the problem is when I upload the code and I try to show it in the serie monitor the monitor is empty and It doesn`t do anything.

I’m using an Arduino UNO board with an ethernet SD shield. This last one is a clone, but the Arduino UNO is an original board.

How can I check the card? Is there any mistake in my code??

Thanks!! And sorry If there`s something wrong in my post but I’m not an english native.

Investigating a little bit more I found that when I upload the example code CardInfo to the Arduino UNO board and I put the serial monitor it responses saying that theres no SD card (the normal response), but when I do the same with the ethernet board mounted It doesnt do anything through the serial monitor. However, the ethernet responses to a petition through the Internet or LAN with a webserver code uploaded and it shows the response on the serial monitor, which means that the ethernet shield works at least in that way.

Any suggestion??

Thanksssss!!!