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
Arya raj
NA
57
34.8k
dynamic attributes and values in httpclient getasyn
Jul 13 2019 5:49 AM
I have to get dynamic attributes and values as parameters in httpclient getasync() from angular.no matter what ever attributes and values in params i should be able to get it in httpclient getasync(). i wote a code like below
[HttpGet]
public
async Task<HttpResponseMessage> QuickSearch([FromUri] queryString)
{
Debugger.Launch();
try
{
using
(HttpClient client =
new
HttpClient())
{
client.DefaultRequestHeaders.Accept.Clear();
//string queryString = "";
//if (!string.IsNullOrEmpty(param.ssn))
//{
// queryString = "?ssn=" + param.ssn;
//}
//if (!string.IsNullOrEmpty(param.applicant))
//{
// queryString = "?applicant=" + param.applicant;
//}
HttpResponseMessage response = await client.GetAsync(
"http://localhost:8080/document/quicksearch/"
+ queryString);
if
(response.IsSuccessStatusCode)
{
Console.Write(
"Success"
);
}
else
{
Console.Write(
"Failure"
);
}
return
response;
}
}
catch
(Exception e)
{
throw
e;
}
}
Reply
Answers (
1
)
how to pass a query parameter in getasyn method in a dynamic
Code Snippet Video Gallery LightBox