Problem with ethernet sheild please help!

hii i am making a project with arduino in which when we press a button on a webserver ,led lights up.i have been able to successfully set up a webserver but whenever i press the button nothing happens,as soon as i upload a sketch led lights up and remain in that position .please help me to sort this out,below are sketches i uploaded to arduino

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

#include <Servo.h>
Servo myservo;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 177 };
byte gateway[] = { 192, 168, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };
EthernetServer server(80);

void setup(){

pinMode(11, OUTPUT);

Ethernet.begin(mac, ip, gateway, subnet);
server.begin();

Serial.begin(9600);
Serial.println("server LED test 1.0");
}

void loop(){

EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();

if (readString.length() < 100) {

readString += c;
Serial.print(c);
}

if (c == '\n') {

Serial.println(readString);

client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();

client.println("");
client.println("");
client.println("");
client.println("");
client.println("");
client.println("Home Automation");
client.println("");
client.println("");
client.println("

Home Automation

");
client.println("
");
client.println("
");

client.println("<a href="/?lighton"">Turn On Light");
client.println("<a href="/?lightoff"">Turn Off Light
");

client.println("");
client.println("");

delay(1);

client.stop();

if(readString.indexOf("?lighton") >0)
{
digitalWrite(11, HIGH);
Serial.println("Led On");
}
else{
if(readString.indexOf("?lightoff") >0)
{
digitalWrite(11, LOW);
Serial.println("Led Off");
}
}

readString="";

(deleted)

What brand shield are you using? I had alot of trouble getting my seeed ethernet shield working. I got it going it was a pain but ill post a copy of my ethernet sketch so you can try that out.

here is my sketch the code controlls three led's and provides an html gui
connect three led's to pins 5,6,7 to try it out

and make sure to put your ip in the sketch

/*
  Web Server
 
 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield. 
 
 */

#include <SPI.h>
#include <EthernetV2_0.h>// this is required if you have the seeed shield you need to download their library from their wiki

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
EthernetServer server(80);
#define W5200_CS  10
#define SDCARD_CS 4
int led = 5;
int led2 = 6;
int led3=7;
int pos = 0;
String readString;
void setup() {
 // Open serial communications and wait for port to open:
 Serial.begin(9600);
 pinMode(SDCARD_CS,OUTPUT);
 digitalWrite(SDCARD_CS,HIGH);//Deselect the SD card
 pinMode(led, OUTPUT);
 pinMode(led2, OUTPUT); 
 pinMode(led3, OUTPUT);
  
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


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;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        
        //read char by char HTTP request
        if (readString.length() < 100) {
          //store characters to string
          readString += c;
          //Serial.print(c);
         }
        
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
           Serial.println(readString); //print to serial monitor for debuging
     
           client.println("HTTP/1.1 200 OK"); //send new page
           client.println("Content-Type: text/html");
           client.println();     
           client.println("<HTML>");
           client.println("<HEAD>");
           client.println("<meta name='apple-mobile-web-app-capable' content='yes' />");
           client.println("<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />");
           client.println("<link rel='stylesheet' type='text/css' href='http://randomnerdtutorials.com/ethernetcss.css' />");
           client.println("<TITLE>Snow Family Home Automation</TITLE>");
           client.println("</HEAD>");
           client.println("<BODY>");
           client.println("<H1>Snow Family Home Automation</H1>");
           client.println("<hr />");
           client.println("
");  
           client.println("
");  
           client.println("<a href=\"/?button1on\"\">Turn On LED</a>");
           client.println("<a href=\"/?button1off\"\">Turn Off LED</a>
");   
           client.println("
");     
           client.println("
"); 
           client.println("<a href=\"/?button2on\"\">Turn on LED2</a>");
           client.println("<a href=\"/?button2off\"\">Turn Off LED2</a>
");   
           client.println("
"); 
           client.println("
");
           client.println("<a href=\"/?button3on\"\">Turn on LED3</a>");
           client.println("<a href=\"/?button3off\"\">Turn Off LED3</a>
");
           client.println("</BODY>");
           client.println("</HTML>");
     
           delay(1);
           //stopping client
           client.stop();
           //controls the Arduino if you press the buttons
           if (readString.indexOf("?button1on") >0){
               digitalWrite(led, HIGH);
           }
           if (readString.indexOf("?button1off") >0){
               digitalWrite(led, LOW);
           }
           if (readString.indexOf("?button2on") >0){
               digitalWrite(led2, HIGH);
              } 
           
           if (readString.indexOf("?button2off") >0){
                 digitalWrite(led2, LOW);
           }
            if (readString.indexOf("?button3on") >0){
               digitalWrite(led3, HIGH);
              } 
           
           if (readString.indexOf("?button3off") >0){
                 digitalWrite(led3, LOW);
           }
            //clearing string for next read
            readString="";  
           
         }
       }
    }
}
}

This is a duplicate thread. The OP was using D11 for the LED. That is a SPI data line.
http://forum.arduino.cc/index.php?topic=266627.0

That is what I was going to suggest next my shield has pin 4 reserved for data. Ethernet shields are finicky.

Ethernet shields are finicky.

Correct. They do not like being used by dumbasses that can't read and follow directions.