Using the current request I can get the URL hostname with:
HttpContext.Current.Request.Url.Host
But - I need to determine the URL hostname with
If you know the host at the moment you're setting up the event handler then you should be able to do something like (code not actually tested):
string host = HttpContext.Current.Request.Url.Host; var dep = new SqlDependency(cmd); dep.OnChange += ((sender, args) => { DoStuff(host); });