c# dns.GetHostEntry() not returning valid ip addressHow do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Get IPv4 addresses from Dns.GetHostEntry()Why not inherit from List<T>?
Transfer over $10k
When do aircrafts become solarcrafts?
A Warm Riley Riddle
When and why did journal article titles become descriptive, rather than creatively allusive?
Unexpected email from Yorkshire Bank
Historically, were women trained for obligatory wars? Or did they serve some other military function?
Stark VS Thanos
Is it cheaper to drop cargo than to land it?
Is there a QGIS plugin that reclassify raster symbology based on current extent?
Accidentally deleted the "/usr/share" folder
How to implement float hashing with approximate equality
How could a planet have most of its water in the atmosphere?
Did we get closer to another plane than we were supposed to, or was the pilot just protecting our delicate sensibilities?
What word means "to make something obsolete"?
Is Cola "probably the best-known" Latin word in the world? If not, which might it be?
What happened to Rhaegal?
Binary Numbers Magic Trick
Why are there synthetic chemicals in our bodies? Where do they come from?
Hang 20lb projector screen on Hardieplank
Why do freehub and cassette have only one position that matches?
Selecting a secure PIN for building access
Why are notes ordered like they are on a piano?
Why do money exchangers give different rates to different bills
Save terminal output to a txt file
c# dns.GetHostEntry() not returning valid ip address
How do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Get IPv4 addresses from Dns.GetHostEntry()Why not inherit from List<T>?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I inherited code that makes the call to Dns.GetHostEntry("10.1.12.180") (or by using the dns of the machine) and the IPHostEntry that is returned has a different ip address "10.100.160.18" If I run the code on the same subdomain (10.1.12) it works. Another developer using WireShark said he doesn't see the call being made and that I must be overriding the GetHostEntry call to return that specific address (we used to have that address on the network). I'm not overriding the call.
I know that I can circumvent the issue by using IPAddress.Parse() since I do have the correct ip address.
Any ideas why it would return the incorrect ip? It used to work. I have checked with IT and they don't have any mappings to the incorrect IP address. The only difference it that the machine with ip address 10.1.12.180 was updated to windows 10 (from Windows 7).
I have isolated the call so that I have a project that just makes the Dns.GetHostEntry() call.
c# dns system.net
add a comment |
I inherited code that makes the call to Dns.GetHostEntry("10.1.12.180") (or by using the dns of the machine) and the IPHostEntry that is returned has a different ip address "10.100.160.18" If I run the code on the same subdomain (10.1.12) it works. Another developer using WireShark said he doesn't see the call being made and that I must be overriding the GetHostEntry call to return that specific address (we used to have that address on the network). I'm not overriding the call.
I know that I can circumvent the issue by using IPAddress.Parse() since I do have the correct ip address.
Any ideas why it would return the incorrect ip? It used to work. I have checked with IT and they don't have any mappings to the incorrect IP address. The only difference it that the machine with ip address 10.1.12.180 was updated to windows 10 (from Windows 7).
I have isolated the call so that I have a project that just makes the Dns.GetHostEntry() call.
c# dns system.net
What doesDns.GetHostEntry(Dns.GetHostName()).AddressList
give you?
– silkfire
Mar 22 at 19:57
It returns a list of ip address which match what I get when I do an ipconfig.
– Bo Knows Diddley
Mar 26 at 16:58
add a comment |
I inherited code that makes the call to Dns.GetHostEntry("10.1.12.180") (or by using the dns of the machine) and the IPHostEntry that is returned has a different ip address "10.100.160.18" If I run the code on the same subdomain (10.1.12) it works. Another developer using WireShark said he doesn't see the call being made and that I must be overriding the GetHostEntry call to return that specific address (we used to have that address on the network). I'm not overriding the call.
I know that I can circumvent the issue by using IPAddress.Parse() since I do have the correct ip address.
Any ideas why it would return the incorrect ip? It used to work. I have checked with IT and they don't have any mappings to the incorrect IP address. The only difference it that the machine with ip address 10.1.12.180 was updated to windows 10 (from Windows 7).
I have isolated the call so that I have a project that just makes the Dns.GetHostEntry() call.
c# dns system.net
I inherited code that makes the call to Dns.GetHostEntry("10.1.12.180") (or by using the dns of the machine) and the IPHostEntry that is returned has a different ip address "10.100.160.18" If I run the code on the same subdomain (10.1.12) it works. Another developer using WireShark said he doesn't see the call being made and that I must be overriding the GetHostEntry call to return that specific address (we used to have that address on the network). I'm not overriding the call.
I know that I can circumvent the issue by using IPAddress.Parse() since I do have the correct ip address.
Any ideas why it would return the incorrect ip? It used to work. I have checked with IT and they don't have any mappings to the incorrect IP address. The only difference it that the machine with ip address 10.1.12.180 was updated to windows 10 (from Windows 7).
I have isolated the call so that I have a project that just makes the Dns.GetHostEntry() call.
c# dns system.net
c# dns system.net
asked Mar 22 at 19:52
Bo Knows DiddleyBo Knows Diddley
34
34
What doesDns.GetHostEntry(Dns.GetHostName()).AddressList
give you?
– silkfire
Mar 22 at 19:57
It returns a list of ip address which match what I get when I do an ipconfig.
– Bo Knows Diddley
Mar 26 at 16:58
add a comment |
What doesDns.GetHostEntry(Dns.GetHostName()).AddressList
give you?
– silkfire
Mar 22 at 19:57
It returns a list of ip address which match what I get when I do an ipconfig.
– Bo Knows Diddley
Mar 26 at 16:58
What does
Dns.GetHostEntry(Dns.GetHostName()).AddressList
give you?– silkfire
Mar 22 at 19:57
What does
Dns.GetHostEntry(Dns.GetHostName()).AddressList
give you?– silkfire
Mar 22 at 19:57
It returns a list of ip address which match what I get when I do an ipconfig.
– Bo Knows Diddley
Mar 26 at 16:58
It returns a list of ip address which match what I get when I do an ipconfig.
– Bo Knows Diddley
Mar 26 at 16:58
add a comment |
1 Answer
1
active
oldest
votes
IPHostEntry
returns a list of addresses, not a single IP address. You should iterate IPHostEntry.AddressList
to see all of them.
See here for example usage of Dns.GetHostEntry
.
Also be aware Windows can override DNS lookups via the hosts
file. This is, unfortunately, a common way to hijack DNS lookups on a specific machine.
I do get a list however, it is a list of one address which is incorrect. I had not thought of checking the hosts file but it contains no mappings.
– Bo Knows Diddley
Mar 26 at 17:08
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55306933%2fc-sharp-dns-gethostentry-not-returning-valid-ip-address%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
IPHostEntry
returns a list of addresses, not a single IP address. You should iterate IPHostEntry.AddressList
to see all of them.
See here for example usage of Dns.GetHostEntry
.
Also be aware Windows can override DNS lookups via the hosts
file. This is, unfortunately, a common way to hijack DNS lookups on a specific machine.
I do get a list however, it is a list of one address which is incorrect. I had not thought of checking the hosts file but it contains no mappings.
– Bo Knows Diddley
Mar 26 at 17:08
add a comment |
IPHostEntry
returns a list of addresses, not a single IP address. You should iterate IPHostEntry.AddressList
to see all of them.
See here for example usage of Dns.GetHostEntry
.
Also be aware Windows can override DNS lookups via the hosts
file. This is, unfortunately, a common way to hijack DNS lookups on a specific machine.
I do get a list however, it is a list of one address which is incorrect. I had not thought of checking the hosts file but it contains no mappings.
– Bo Knows Diddley
Mar 26 at 17:08
add a comment |
IPHostEntry
returns a list of addresses, not a single IP address. You should iterate IPHostEntry.AddressList
to see all of them.
See here for example usage of Dns.GetHostEntry
.
Also be aware Windows can override DNS lookups via the hosts
file. This is, unfortunately, a common way to hijack DNS lookups on a specific machine.
IPHostEntry
returns a list of addresses, not a single IP address. You should iterate IPHostEntry.AddressList
to see all of them.
See here for example usage of Dns.GetHostEntry
.
Also be aware Windows can override DNS lookups via the hosts
file. This is, unfortunately, a common way to hijack DNS lookups on a specific machine.
answered Mar 22 at 20:01
Zer0Zer0
3,7281229
3,7281229
I do get a list however, it is a list of one address which is incorrect. I had not thought of checking the hosts file but it contains no mappings.
– Bo Knows Diddley
Mar 26 at 17:08
add a comment |
I do get a list however, it is a list of one address which is incorrect. I had not thought of checking the hosts file but it contains no mappings.
– Bo Knows Diddley
Mar 26 at 17:08
I do get a list however, it is a list of one address which is incorrect. I had not thought of checking the hosts file but it contains no mappings.
– Bo Knows Diddley
Mar 26 at 17:08
I do get a list however, it is a list of one address which is incorrect. I had not thought of checking the hosts file but it contains no mappings.
– Bo Knows Diddley
Mar 26 at 17:08
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55306933%2fc-sharp-dns-gethostentry-not-returning-valid-ip-address%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What does
Dns.GetHostEntry(Dns.GetHostName()).AddressList
give you?– silkfire
Mar 22 at 19:57
It returns a list of ip address which match what I get when I do an ipconfig.
– Bo Knows Diddley
Mar 26 at 16:58