tags:

views:

60

answers:

3

Hello,

I am playing around with Silverlight. Currently, as a test to see if I like the technology, I'm building a utility. This utility simply checks to see if my web sites are up and running.

With Silverlight, C#, how do I ping a website (like www.google.com) to see if it is available?

Thank you

+1  A: 

In the simplest case, can you make a TCP connection on port 80 (the default HTTP port) and issue a GET or HEAD request ?

Note that determining if a site is up is a very subjective question. e.g.

  1. does it listen on port 80 ?
  2. does it respond to a HEAD/GET request ?
  3. is its underlying database available (or do you get an error page saying that underlying services are down) ?
  4. does it respond in a timely fashion ?

etc.

Brian Agnew
+2  A: 

You also have to fix up some sort of cross-domain permissions with strategically placed clientaccesspolicy.xml files to allow a Silverlight app running in one domain access to the other domains.

http://msdn.microsoft.com/en-us/library/cc645032%28VS.95%29.aspx

http://timheuer.com/blog/archive/2008/04/06/silverlight-cross-domain-policy-file-snippet-intellisense.aspx

spender
A: 

Check out this question: Best way to test if a website is alive from a C# applicaiton

dbrmr