15,913,722 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Adi_Mag (Top 5 by date)
Adi_Mag
1-Jan-17 13:23pm
View
The service is secured service. To access the get_endpoint. We need to pass the access_token. We can not violate rest principles by making get request as post. Any thoughts on this ?
Adi_Mag
1-Jan-17 13:15pm
View
One more point :
Get Rest Endpoint : http://www.customerservices.com/Customers/{id}?access_token=12345
Is it a right approach?
My earlier approach was to send this access_token in DefaultRequestHeader. But defaultRequsetHeader Causes Issue.
Adi_Mag
1-Jan-17 12:59pm
View
Thanks a lot.
Adi_Mag
1-Jan-17 12:50pm
View
I have used parallel because multiple clients try to access the application. I am mimicking the real time scenario.
Adi_Mag
1-Jan-17 12:44pm
View
My application flow is client===>webapi===>authentication server. We get accesstoken from client request. Then we connect to authentication server for validation. For this validation, we are using httpclient. We need to set the access header of the httpclient with access token. If I use the same instance of HttpClient then the race condition comes up.
Simple POC :
Parallel.For(0, 10,
i =>
{
var guidData = Guid.NewGuid().ToString();
_httpClient.DefaultRequestHeaders.Clear();
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
_httpClient.DefaultRequestHeaders.Add("Guid", guidData);
var response = _httpClient.GetAsync("http://localhost:2967/api/service/GetData").GetAwaiter().GetResul();
var data = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
Console.WriteLine(data);
Console.WriteLine("===============");
});
Error : Getting error, the guid is already added.