If this problem comes again follow the best solution below.
Go to Command Prompt by pressing windows key and X and select Command Prompt.
Now, just paste these commands one by one and after every command hit enter.
Commands: ipconfig /release
ipconfig /all
ipconfig /flushDNS
ipconfig /renew
netsh int ip set DNS
netsh winsock reset
Lastly, just reset your PC or the device and see if it makes any changes.