Reputation: 461
I need to call a Response.Redirect method from C# but I need to do it in such a way that it ignores the Hosts file on windows for this call?
For example, if on Hosts I have:
127.0.0.1 google.com
and I call a Response.Redirect("google.com"), I need it to ignore the hosts just for this one call and actually go to google.com rather than localhost. How could I do this?
I know I could call a Response.Redirect on google's IP address but is there a better way?
Upvotes: 3
Views: 2854
Reputation: 92752
No, probably not: DNS lookup is handed over to your OS, which checks...hosts
file.
Iff you can
http://10.15.6.4/some/path
(Google Search accepts an IP hostname and works, btw)), then it might work.
Upvotes: 3
Reputation: 2393
If you can know the IP address of the host without asking the OS ( e.g. via 3rd party ) .. then you actually ignored the hosts files .
Upvotes: 1