When you try to change the Hosts file or the Lmhosts file in Microsoft Windows Vista, or Windows 7, you may receive an error message that resembles either of the following.
Access to C:\Windows\System32\drivers\etc\hosts was denied
or
Cannot create the C:\Windows\System32\drivers\etc\hosts file.
Make sure that the path and file name are correct.
This issue occurs even though you log on by using an account that has administrative credentials.
To deal with the issue, follow these steps:
1. Click Start, click All Programs, click Accessories, right-click Notepad, and then click Run as administrator.
2 . Open the Hosts file or the Lmhosts file, make the necessary changes, and then click Save on the Edit menu. If using Windows 7, you will need to click Save on the File menu.