TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sivakumar
NA
551
218.3k
How to return a token value an windows form application
Sep 9 2015 2:56 AM
Hi,
I am Implemented windows form application for consuming web api and return values in windows form grid view.
like this :
When i click submit button it return a values like this :
at the same how to implement
login api
using [Post] method and return a token value in a grid view.
this is my code for getting employee values :
private void button1_Click(object sender, EventArgs e)
{
URI = textBox2.Text + textBox1.Text;
GetAllEmployees();
}
#region Methods
private async void GetAllEmployees()
{
using (var client = new HttpClient())
{
using (var response = await client.GetAsync(URI))
{
if (response.IsSuccessStatusCode)
{
var productJsonString = await response.Content.ReadAsStringAsync();
dataGridView1.DataSource = JsonConvert.DeserializeObject<Employee[]>(productJsonString).ToList();
}
}
}
}
#endregion
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public string desig { get; set; }
public decimal salary { get; set; }
}
}
}
I am using a rest tool and login successful and get a access token. but i want to get access token in windows form.
Please give me code for login api and get a token in gridview.
Reply
Answers (
0
)
Is object and instance different??
Dropdownlist