I have two laptops with an aluminium case that often give me electric shock when I use them in bed.
They are currently connected to the AC using extension leads as I do not have a socket close to my bed, so I wonder whether that's causing this?
Is this dangerous?
electrical shocks of any kind not good, you have on your lap a device full of microchips. All it takes is 1 zap to kill a chip.
Since you have provided no information you will have to determine how to eliminate / determine cause
Is the laptop plugged directly to AC power? I ask because most laptops are powered by DC voltage (harder to get any kind of a shock)
If AC is plugged into laptop verify you have a good ground connected through the extension.
Now if it's static, use a ground strap (google it if your unsure) or increase the humidity in the bedroom.
Yes the laptop is connected to the AC I guess (all homes would use AC expect?). but via a 1 or 2 extension leads as the wall socket is far away. They are cheap ones so I am thinking they might be the cause of the issue.
How can I verify if I have good ground connection through the extension?
Do your extensions have a ground wire in them (3 wires 2 for power 1 for ground)
I have to ask again as most laptops have a converter that takes your 120 and turns it into 24 volts dc. Does you AC 120 plug into the computer?
Next inspect the extension you could have a bare spot on one of the wires and it could be touching your case.
Next does your power company supply an actual ground or is the neutral also ground? Check that the hot wire is always connected to the hot wire. (large plug/spade is common) If you connect the hot wire to the common side of the laptop you could put a potential on case. (most manufacturers would ensure isolation and use a 3 prong plug.) If laptop has a 3 prong plug then get an extension that uses the 3 prong.
It would be interesting if you could get a meter and measure the voltage, much easier to figure out where its coming from.