Most phone and computer OSes create a profile for each Wi-Fi network you connect to. If you tell the system to forget the network, it also forgets the password, so this trick won't work in that case.