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
rahul patil
NA
160
8.5k
how to create a token and then after authorize person access
Jun 14 2020 12:53 AM
now when I click on the send button of postman then direct access the index method that is issue I want to generate a token and then after authorize person access that method
staticvariable.cs
public
static
class
staticvariable
{
public
static
HttpClient webapiclient =
new
HttpClient();
static
staticvariable()
{
webapiclient.BaseAddress =
new
Uri(
"http://localhost:5718/api/"
);
webapiclient.DefaultRequestHeaders.Clear();
webapiclient.DefaultRequestHeaders.Accept.Add(
new
MediaTypeWithQualityHeaderValue(
"application/json"
));
}
}
studController.cs
public
class
studController : Controller
{
// GET: Home
public
JsonResult Index()
{
IEnumerable<student> studlist;
HttpResponseMessage response = staticvariable.webapiclient.GetAsync(
"stud"
).Result;
studlist = response.Content.ReadAsAsync<IEnumerable<student>>().Result;
return
Json(studlist,JsonRequestBehavior.AllowGet);
}
}
what i want to the
when click on the send button of the postman then after generate the token means authoriz person can access that index method
help?
Reply
Answers (
1
)
how to send ajax
Import Data From excel into Sql Server using C# and Eppplus