DNS server override for application

  • Thread starter Thread starter Alex Chudnovsky
  • Start date Start date
A

Alex Chudnovsky

Hi,

I've got an application that heavily uses .NET HTTP functions, that in
turn use DNS resolves - I would like to make my application use specific
DNS servers that happen to be more reliable in terms of resolves than
average consumer grade network setup, the question is whether it is
possible at all in a .NET app without moving away completely from
build-in HTTP library?

Version of .NET in question is 2.0+.

regards,

Alex
 
No, it's not possible without moving away from built-in classes, such as the
System.Net.Dns class, which does not allow you to configure the DNS server
it connects to. It is possible, of course, by writing a class that uses a
TCP Socket to send and receive queries to and from any DNS server.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 
Kevin said:
No, it's not possible without moving away from built-in classes, such as the
System.Net.Dns class, which does not allow you to configure the DNS server
it connects to. It is possible, of course, by writing a class that uses a
TCP Socket to send and receive queries to and from any DNS server.

Yes, that's what I thought myself - it is very odd that Dns class does
not allow to specify alternative Dns servers and that HttpWebRequest
can't accept cached Dns resolves done earlier - and shared source code's
license does not allow changes to be made to this code to them use it in
your own application (unless it's non-commercial - which is too big of a
restriction).

regards,

Alex
 
I find the greatest benefit to the shared source code (or any open source
code) is in seeing how they solved the problem. One can then incorporate a
similar (or even improved) approach without violating any licensing
agreements.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 
Kevin said:
I find the greatest benefit to the shared source code (or any open source
code) is in seeing how they solved the problem. One can then incorporate a
similar (or even improved) approach without violating any licensing
agreements.

It might be useful in some cases for sure, however when it comes to
extending functionality it is useless because it is too easy to taint
your own code by doing something that is just too similar in existing
sources so I reluctantly decided not even to look at implementation of
HttpWebRequest - it looks like the only avenue is to take Mono's
implementation and modify it :(

It is really odd Microsoft does not allow some degree of modification
designed to improve applications running on .NET platform - I can
understand they don't want people to take whole of CLR to change a few
lines and claim they have their own .NET implementation, but allowing to
extend elements of class library to use in commercial applications is a
must IMO.


regards,

Alex
 
Back
Top