What you are trying to do by your code is to see if the domain has a resolving dns A record for bks-campus.ch. What you want to do is request the SOA record for a domain. see this CodeProject project that searches for the MX record. Just change the type of record to SOA
This will only work if the domain has been delegated to a name server. There are some domains that have been registered and just not pointed to a DNS server. In these cases you will just get an error message if you enter the domain name into a browser.
The BEST way to find out if a domain has been registered is to do a WHOIS lookup. These are run by the TLD Registries to allow people to check who has registered a domain name. If you telnet to port 43 of whois.nic.coop and type in a domain name "nosuchdomain.coop" you will get the details of who registered that domain.
.coop registry WHOIS server
For help on using this server use "?" (without the quotes).
For more .coop information browse to http://www.coop
nosuchdomain.coop
No domain records were found to match "nosuchdomain.coop"
--------------------------------------------------------------------------------
The .coop registry WHOIS database provides information for .coop registered
names only. Although every effort is made to maintain the accuracy of the WHOIS
data, accuracy cannot be guaranteed.
This service is intended only for query-based access. You agree that you will
use this data only for lawful purposes and that, under no circumstances will you
use this data to: (a) allow, enable, or otherwise support the transmission by
e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or
solicitations to entities other than the data recipient's own existing
customers; or (b) enable high volume, automated, electronic processes that send
queries or data to the systems of Registry Operator or any ICANN-Accredited
Registrar, except as reasonably necessary to register domain names or modify
existing registrations. The compilation, repackaging, dissemination or other use
of this Data is expressly prohibited without the prior written consent of
dotCoop. All rights reserved. dotCoop reserves the right to modify these terms
at any time. By submitting this query, you agree to abide by this policy.
BY USING THE WHOIS SERVICE AND THE DATA CONTAINED HEREIN OR IN ANY REPORT
GENERATED WITH RESPECT THERETO, IT IS ACCEPTED THAT DOTCOOP IS NOT LIABLE FOR
ANY DAMAGES OF ANY KIND ARISING OUT OF, OR IN CONNECTION WITH, THE REPORT OR THE
INFORMATION PROVIDED BY THE WHOIS SERVICE, NOR OMISSIONS OR MISSING INFORMATION.
THE RESULTS OF ANY WHOIS REPORT OR INFORMATION PROVIDED BY THE WHOIS SERVICE
CANNOT BE RELIED UPON IN CONTEMPLATION OF LEGAL PROCEEDINGS WITHOUT FURTHER
VERIFICATION, NOR DO SUCH RESULTS CONSTITUTE A LEGAL OPINION.
If you open a socket to this port on the correct server and just send them the domain, capture the response, and then parse this to see if the WHOIS server reports if the domain is registered or not.