Last active
April 29, 2020 18:42
-
-
Save weeksdev/46aef265329602e0b549e0b65987ef30 to your computer and use it in GitHub Desktop.
Info on CSX Scripts
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
using System; | |
using System.Net; | |
class Webby | |
{ | |
public string Request(string url, string processName) | |
{ | |
try | |
{ | |
WebClient client = new WebClient(); | |
client.Headers.Add("x-referrer", processName); | |
client.Headers.Add("x-process-name", processName); | |
client.Headers.Add("x-machine-name", processName); | |
var result = client.DownloadString(url); | |
return result; | |
} | |
catch (WebException ex) | |
{ | |
return "error"; | |
} | |
} | |
} | |
static class Main | |
{ | |
public static void Run(string[] args) | |
{ | |
Console.WriteLine("Testing Single User"); | |
Console.WriteLine(new Webby().Request("https://localhost:44390/api/v1/some-url", "test-1")); | |
} | |
} | |
Main.Run(Environment.GetCommandLineArgs()); |
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
using System; | |
// tutorial: https://itnext.io/hitchhikers-guide-to-the-c-scripting-13e45f753af9 | |
// dotnet tool install -g dotnet-script | |
// dotnet-script init my-script | |
// can open the folder in vscode | |
// or run the script: dotnet-script my-script.csx | |
Console.WriteLine("Oh, Hello"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment