MEGA 2560 proto shield and W5100 shield

Is there a way to mount a w5100 shield on top of a proto shield for MEGA2560 and have it working just as if the proto shield wasn't there?

Conditionally yes. If the proto shield feeds the ICSP pins through to the upper shield.

the problem is that the icsp headers are in the corner like the majority or proto shield. So in theory I could make a cable with 3x2 pin male/female connector and connect the icsp headers of the proto shield to the connector below of the w5100, right? Or solders 6 pins on the perf board of the proto shield and solder some wires below the icsp header of the proto shield.

You could do that or find a proto board with the ICSP pins. I found a few. Google arduino proto shield and select images.

I'll search for those tnx. I never seen one so far, so I never thought about them