0

I need to get the values in IPHostEntry without using Dns.GetHostEntry(). I want some other approach to get the values in IPHostEntry whatever the Dns.GetHostEntry() is doing. I did not get exact solution. Below I have shared my code.

   String urlSvr = m.Groups[2].Value.ToLower();
    IPHostEntry serverEntry = Dns.GetHostEntry(machine);

                if ( urlSvr == machine||
                    machine.StartsWith(urlSvr) ||
                    urlSvr == serverEntry.AddressList[0].ToString())
                {
                    _log.Debug(
                    String.Format(CultureInfo.InvariantCulture, "Machine match {0}, {1}", machine, urlSvr ));
                }
   

I am not suppose to use Dns.GetHostEntry(machine) but need to get values in serverEntry with different approach. Kindly suggest.

zia
  • 25
  • 5
  • Your question attempts to explain what you don't want, but nothing about what you do want. What exactly are you trying to achieve? – Jeremy Lakeman Aug 10 '22 at 04:39
  • I want same output what i am getting for Dns.GetHostEntry(machine) with different approach – zia Aug 10 '22 at 05:34
  • 1
    What do you mean by the "same output"? what do you mean by "different approach"? why can't you use `Dns.GetHostEntry`? Provide clear examples in your question. – Jeremy Lakeman Aug 10 '22 at 05:36
  • I need serverEntry.AddressList[0].ToString() and this Dns.GetHostEntry() creates Often Misused: Authentication in fortify scan. I am unable to find any other solution. – zia Aug 10 '22 at 07:07
  • You still haven't explained what you are trying to achieve. *Why* are you comparing the string of an IP address or a machines name? Is your question a dupe of https://stackoverflow.com/questions/37459945/fortify-fix-for-often-misused-authentication ? Since you still haven't provided any context, I can't tell. – Jeremy Lakeman Aug 11 '22 at 00:51

0 Answers0