When the iPhone (4) goes to sleep, the VPN will disconnect. Is there any way to disable this behavior as it's sometimes a bit annoying.
I am jailbroken, and the server I'm connecting to is Windows Server 2008 R2 which I can edit settings on.
The VPN will disconnect because your WiFi disconnects.
Therefore you would have to...
To keep WiFi on in sleep mode you need to install KeepAwake via Cydia.
See this step-by-step guide.
I would expect that sleeping an iPhone and staying connected to the network are incompatible goals. If you don't want to drop the VPN connection, you need to keep the device awake.
However, I found a discussion on apple.com that states that plugged-in devices are able to maintain network connections while in sleep mode.
This works for me iPhone 5 iso 6.1.4;
hopefully this will help you.