using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net.Http; namespace WebApplicationfortestingapi { public partial class WebForm1txtbutton : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSubmit_Click(object sender, EventArgs e) { HttpClient client = new HttpClient(); //for request and response string gstId = txtgstNumber.Text; string path = API=" + gstId; HttpResponseMessage response = client.GetAsync(path).Result; if (response.IsSuccessStatusCode) { var jsonString = response.Content.ReadAsStringAsync(); string result = jsonString.Result; if (result == "True") { lblmsg.Text = "Valid GST Number"; } else { lblmsg.Text = "Invalid GST Number"; } } else { lblmsg.Text = "API Not Hitting"; } } }
API
path
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)