Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Net.Http;
- using System.Windows.Forms;
- namespace CommandAPI
- {
- public partial class CommandScreen : Form
- {
- Uri uri = new Uri("https://commandapi.glitch.me/");
- HttpClient client = new HttpClient();
- public CommandScreen()
- {
- InitializeComponent();
- client.BaseAddress = uri;
- }
- private async void sendButton_Click(object sender, EventArgs e)
- {
- var cmdBox = commandBox;
- if (cmdBox.TextLength <= 3)
- {
- cmdBox.Text = "Enter a valid command";
- return;
- }
- var newTxt = cmdBox.Text.Replace(" ", "_");
- var response = await client.GetAsync("getCommands"); // Even if I change the Uri to https://commandapi.glitch.me/getCommands
- Console.WriteLine(response.StatusCode); // Forbidden
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement