Link to home
Start Free TrialLog in
Avatar of MOSTAGHASSI
MOSTAGHASSIFlag for United States of America

asked on

Problem in working of 'hosts' file in win7

Hello;

I want to edit 'hosts' file in Windows: C:\Windows\System32\drivers\etc\hosts and i do as this below but it doesn't work,where is the problem?

-I open notepad as administrator and edit the 'hosts' file but it doesnt work.

I have checked the properties of hosts file and in security section->permissions of users the section 'allow'  all check marked but ,
read &execute  and  read  are gray.
Avatar of cwstad2
cwstad2
Flag of United Kingdom of Great Britain and Northern Ireland image

i usually edit it and save it to a different location. Rename the original then copy the newly edited one to the original hosts location
"I open notepad as administrator" - you do that via rightclick on notepad.exe and selecting "run as administrator"? Then it would work.
ASKER CERTIFIED SOLUTION
Avatar of jcimarron
jcimarron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MOSTAGHASSI

ASKER

I save it correctly ,and i right click on notepad for editing as administrator.

I get ping from my IP and it is ok ,but in browser cannot see the site,it connect to main server which is running now.
So it saves? Saving is not the problem, it only doesn't get used somehow?
Ok, I got that wrong.

You write "I get ping from my IP" - what does that mean?
Please do add a line to your hosts
test 127.0.0.1

Save it and ping test
Does that ping 127.0.0.1?
Please add content of your hosts file
the result of ping test:

C:\Users\SunMedia>ping test

Pinging test [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0%
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
That works. Please describe what doesn't work and add the contents of your hostsfile.
When i type the address of domain that i have mapped in hosts file in address bar then i connect to main server which is running now.

this is as example
i add 2 lines as below to hosts file:

2.2.2.2      mydomain.com
2.2.2.2      www.mydomain.com

than i type mydomain.com in address bar so i expect that connect to 2.2.2.2 server but i connect to main server .
MOSTAGHASSI--
"and i right click on notepad for editing as administrator"

No, you click on HOSTS and run as Admin.

So  you were able add 2.2.2.2 my domain.com to your HOSTS file?

Have you looked into the other suggestions I made?  http:#a40858014
jcimarron--

I right click on hosts file but there is not option 'open as administrator'.
Another way to run notepad as administrator...

Pick Start.
Type notepad.
Right-click the notepad program and pick run as administrator
After notepad opens, drop your hosts file onto the open notepad.
jcimarron--

I read your links,first link is ok on my pc,and second link i cannt see any file for downloading.
jcimarron--

I could find the zip file(Takeownership) but i fear that after installing it stop my pc,are you sure that it is ok ?
What was your problem? You were able to edit the hosts file before, so why did you select that solution?
Editing was ok but because i didn't had permission it doesn't work.
What does that mean? When you can save it, the job is done. Changing ownership does not change anything, then.