Skip to content

Instantly share code, notes, and snippets.

@stephensmitchell
Forked from alexander-williamson/Recurse.cs
Last active April 19, 2018 01:00
Show Gist options
  • Save stephensmitchell/4bb45cfb42417d504b6fbfe565f9e513 to your computer and use it in GitHub Desktop.
Save stephensmitchell/4bb45cfb42417d504b6fbfe565f9e513 to your computer and use it in GitHub Desktop.
Simple LinqPad example to hit an endpoint #LINQPad
// 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