Skip to content

Instantly share code, notes, and snippets.

@alexander-williamson
Created September 22, 2016 09:26
Show Gist options
  • Save alexander-williamson/c4bb3c5681842f76963efcbcbe1b09aa to your computer and use it in GitHub Desktop.
Save alexander-williamson/c4bb3c5681842f76963efcbcbe1b09aa to your computer and use it in GitHub Desktop.
Simple LinqPad example to hit an endpoint
// Needs System.Net;
// Prefer HttpClient for real situations other than testing
void Main()
{
while(true) {
try {
var url = "http://example.com/sub/dir/page.aspx?a=1234&b=something";
var request = (System.Net.HttpWebRequest) System.Net.WebRequest.Create (url);
var response = (System.Net.HttpWebResponse)request.GetResponse ();
Console.WriteLine("Finished");
} catch(Exception ex) {
Console.WriteLine(ex);
}
Console.WriteLine("Looping");
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment