Created
September 22, 2016 09:26
-
-
Save alexander-williamson/c4bb3c5681842f76963efcbcbe1b09aa to your computer and use it in GitHub Desktop.
Simple LinqPad example to hit an endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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