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;








0















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.










share|improve this question






















  • 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

















0















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.










share|improve this question






















  • 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













0












0








0








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 19:52









Bo Knows DiddleyBo Knows Diddley

34




34












  • 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

















  • 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
















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












1 Answer
1






active

oldest

votes


















0














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.






share|improve this answer























  • 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











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
);



);













draft saved

draft discarded


















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









0














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.






share|improve this answer























  • 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















0














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.






share|improve this answer























  • 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













0












0








0







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript