I tried a lot of ways to fix it… but for I dont found anything that allow me just use the network…
I have a Cerbuino Bee with ENC28 at Socket1 and I loaded the firmware with ethernet.
I now that on this way I should use NETMF and not Gadgeteer apis and codes…
This is my short and very easy code:
void ProgramStarted()
{
Debug.Print("Program Started");
this.timer = new Timer(100);
this.timer.Tick += timer_Tick;
this.timer.Start();
}
void timer_Tick(Timer timer)
{
timer.Stop();
Mainboard.SetDebugLED(true);
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
NetworkInterface eth = interfaces[0];
Debug.Print("IP => " + eth.IPAddress);
Debug.Print("NetworkInterfaceType => " + eth.NetworkInterfaceType);
Debug.Print("SubnetMask => " + eth.SubnetMask);
Debug.Print("IsDhcpEnabled => " + eth.IsDhcpEnabled);
Debug.Print("PhysicalAddress => " + eth.PhysicalAddress);
Debug.Print("Gateway => " + eth.GatewayAddress);
try
{
WebRequest request = WebRequest.Create("http://173.194.41.31/");
WebResponse response = request.GetResponse();
response.Close();
}
catch (System.Exception ex)
{
Debug.Print(ex.InnerException.InnerException.StackTrace);
}
}
Start the program:
Using mainboard GHI Electronics FEZCerbuinoBee version 1.2
Program Started
IP => 192.168.1.4
NetworkInterfaceType => 6
SubnetMask => 255.255.255.0
IsDhcpEnabled => False
PhysicalAddress => System.Byte[]
Gateway => 192.168.1.1
Now exception:
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
And the stacktrace:
Microsoft.SPOT.Net.SocketNative::poll
System.Net.Sockets.Socket::Poll
System.Net.Sockets.Socket::Connect
System.Net.HttpWebRequest::EstablishConnection
System.Net.HttpWebRequest::SubmitRequest
System.Net.HttpWebRequest::GetResponse
GadgeteerApp3.Program::timer_Tick
Gadgeteer.Timer::dt_Tick
Microsoft.SPOT.DispatcherTimer::FireTick
Microsoft.SPOT.Dispatcher::PushFrameImpl
Microsoft.SPOT.Dispatcher::PushFrame
Microsoft.SPOT.Dispatcher::Run
Gadgeteer.Program::Run
GadgeteerApp3.Program::Main
I try to fix all weekend … please help me or burn my enc28 module
as you want 
[quote]
WebRequest request = WebRequest.Create("http://173.194.41.31/");
WebResponse response = request.GetResponse();
response.Close();
][/quote]
response.close() or request.close()
does not matter, because halt and throw socketexception at request.Getresponse()
@ SergioZgz - Next code… Works for me.
To avoid other noises, first try to getResponse using static address, mask…etc.
void ProgramStarted()
{
Debug.Print("Initializing network...");
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
if (interfaces != null && interfaces.Length > 0)
{
NetworkInterface eth = interfaces[0];
eth.EnableStaticIP("x.x.x.x", "y.y.y.y", "z.z.z.z");
eth.EnableStaticDns(new[] { "d.d.d.d", "n.n.n.n" });
// eth.EnableDhcp();
Debug.Print("IP => " + eth.IPAddress);
Debug.Print("NetworkInterfaceType => " + eth.NetworkInterfaceType);
Debug.Print("SubnetMask => " + eth.SubnetMask);
Debug.Print("IsDhcpEnabled => " + eth.IsDhcpEnabled);
Debug.Print("PhysicalAddress => " + eth.PhysicalAddress);
Debug.Print("Gateway => " + eth.GatewayAddress);
GT.Timer _timer = new GT.Timer(5000);
_timer.Tick += _timer_Tick;
_timer.Start();
Debug.Print("Start request");
request();
Debug.Print("End request");
}
else
{
Debug.Print("ENC28 device not found.");
}
}
void request()
{
try
{
WebRequest request = WebRequest.Create("http://yourPageRequest");
WebResponse response = request.GetResponse();
Debug.Print("Content Received : " + response.ContentLength.ToString());
response.Close();
}
catch (System.Exception ex)
{
Debug.Print(ex.InnerException.InnerException.StackTrace);
}
}
void _timer_Tick(GT.Timer timer)
{
PulseDebugLED();
}
}
Regards,
PepLluis,
Hi PepLluis are you from Spain right?? I think that I read some post from you because I get this cerbuino bee with enc28 from microsoft 
This is my output (I tryed to 192.168.1.1 and to local apache server and to google and to microsoft :S ):
Using mainboard GHI Electronics FEZCerbuinoBee version 1.2
Initializing network…
IP => 192.168.1.7
NetworkInterfaceType => 6
SubnetMask => 255.255.255.0
IsDhcpEnabled => False
PhysicalAddress => System.Byte[]
Gateway => 192.168.1.1
Start request
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
A first chance exception of type ‘System.Net.WebException’ occurred in System.Http.dll
Microsoft.SPOT.Net.SocketNative::poll
System.Net.Sockets.Socket::Poll
System.Net.Sockets.Socket::Connect
System.Net.HttpWebRequest::EstablishConnection
System.Net.HttpWebRequest::SubmitRequest
System.Net.HttpWebRequest::GetResponse
GadgeteerApp3.Program::request
GadgeteerApp3.Program::ProgramStarted
GadgeteerApp3.Program::Main
End request
PulseDebugLED called
The thread ‘’ (0x3) has exited with code 0 (0x0).
PulseDebugLED called
PulseDebugLED called
Hi Sergio!
You are right… Is a pleasure meet with blog readers.
Please let me know if you are using VS2010 or VS2012… and tomorrow I try to test in local.
I’m not sure if you have any problem with your eth connection, or may be to slow 
try extent : request.Timeout, after créate.
Sorry for ask… the firmware are update to last rev?
Best,
PepLluis,