Click here to Skip to main content
14,304,152 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi ,

I want my application to be notified when the hostname of the system on which it is running changes. Is there some way to do it in C# ?

I am looking for something similar to NetworkChange.NetworkAddressChanged which will raise an event whenever the IP address of the system changes and hence applications can be notified.

Thanks for the help.
Bernhard Hiller 26-Jan-12 6:33am
Isn't it necessary to re-start the computer for the hostname change to take effect?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

One solution can be this :

Hostname is stored in registry at address :

under the key name of ComputerName

Get notified of its changes by this way:[^]

There are also other solutions to watch for registry changes which can be found by Google.

Hope it helps.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100