Skip to content

Instantly share code, notes, and snippets.



Created Feb 22, 2012
What would you like to do?
using System;
using System.Net;
namespace TeamEXtension
public class UrlPing
public static void Main(string[] args)
string urlString = "";
try {
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(urlString);
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
catch (Exception e) {
// log error

This comment has been minimized.

Copy link

@dpolistbpc dpolistbpc commented Apr 26, 2016

Simpler implementation:

public string Ping(string url)
    using (var webClient = new WebClient())
        return webClient.DownloadString(url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.