my code stock.com

Vishrut Jambudi

Call Web Api GET() method from MVC Controller of different project.
by Vishrut Jambudi

GET() Method

Snippet options

Download: Download snippet as call-web-api-get-method-from-mvc-controller-of-different-project.cpp.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

 using (var client = new HttpClient())
 2             {
 3                 client.BaseAddress = new Uri("http://192.168.1.86:222/api/Registration/");
 4                 //client.DefaultRequestHeaders.Accept.Clear();
 5                 //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
 6                 var response = client.GetAsync("Delete/" + id + "").Result;
 7                 if (response.IsSuccessStatusCode)
 8                 {
 9                     string responseString = response.Content.ReadAsStringAsync().Result;
10                     return RedirectToAction("Index");
11                 }
12             }

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.