Questions tagged [getasync]

50 questions
1
vote
1 answer

C# GetAsync Won't Work with Django Rest Framework

This is the function in my HomeController.cs: async Task> GetSiteWithID(int ID) { using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new…
pedroremedios
  • 763
  • 1
  • 11
  • 39
1
vote
1 answer

Cursor movement in password input c++\

I have this c++ program to accept the username and the password(which is masked) and compare them to preset values. If they are same, the program closes, otherwise it loops back to the beginning. I have had some difficulty with the password input,…
Anchith Acharya
  • 369
  • 1
  • 4
  • 16
1
vote
0 answers

Store header key and value using HttpResponseMessage, GetAsynch

I have the following code and I want to store all keys and values of the header (i.e. cookie, session id, etc) in KeyValuepair type of an object. How can I accomplish that? CookieContainer cookies = new CookieContainer(); HttpClientHandler…
Puzzle
  • 25
  • 2
  • 2
  • 7
1
vote
1 answer

Check GetStreamAsync status

Grabbing an image via GetStreamAsync, how do I determine status? HttpClient OpenClient = new HttpClient(); Stream firstImageStream = OpenClient.GetStreamAsync("imageUrl.jpg").Result; Sometimes this will give an error (403 or 404 typically) and I…
Randy Hall
  • 7,716
  • 16
  • 73
  • 151
0
votes
1 answer

In my Blazor WebAssembly app one of my calls to the back end works fine with certain IDs but not with others

I am creating a Blazor WebAssembly app using .net 7 and I have the most bizzare problem. In my client I am making a call to the server. It's a really simple call to get a Room item from the database and it sends the ID of the room to the controller…
Simon Bailey
  • 41
  • 1
  • 4
0
votes
0 answers

API Response: NET_HTTP_REQUEST_TIMEDOUT 100

at first, sorry for my english. :) In my home-network (with IIS), i have a API at the address: http://pcname:8089. Then i have programmed a MAUI-App (Blazor) for Android and published it to my SAMSUNG S21. Now i have the following effects: PC:…
esehigs
  • 5
  • 1
0
votes
1 answer

HttpClient getAsync just works once

I'm trying to call a endpoint to get some info in my website but when I run the getAsync it's only works the first time in the current process. static async Task Main(string[] args) { await GetUserInfo("srmilton"); //Working await…
SrMilton
  • 45
  • 6
0
votes
2 answers

HttpClient GetAsync working in a VB.Net Console application but not in Windows Forms

Works as expected in the console application (I converted it from a C# YouTube tutorial for reasons I won't bore you with), but hangs with no exception thrown in the desktop app when calling GetAsync. Imports System Imports System.Net.Http Module…
0
votes
0 answers

GetAsync with object parameter value in asp.net core

In TypesScript, I have an interface defined as export interface ClientReportParm { StartDate?: Date; EndDate?: Date; } I have a method that calls an API endpoint defined as ClientReport(parm: ClientReportParm) { this.searchParams = new…
0
votes
0 answers

Xamarin App does nothing after await the GetAsync method

I have created a class, in Xamarin Forms, that requests to a web API about the details of countries. Right now, I am testing only with a country. However, once the line "HttpResponseMessage response = await client.GetAsync(uri);" is executed, the…
Henry
  • 167
  • 1
  • 1
  • 8
0
votes
0 answers

GetAsyncKeyState Toggling

I'm trying to make a very basic 'switch' that will toggle by pressing the HOME key. I've come up with a solution that will display "Off." or "On." in console depending on whether "bool homeKeyWasDown" is true or false. So, I have technically…
ItsDave
  • 1
  • 1
0
votes
1 answer

Do something periodically while waiting for result of an GetAsync

I want to start an GetAsync or PostAsync and then in a loop do something and check for results. req1 = client.GetAsync(url_1); // a time consuming request do { //do something here var req2= await client.GetAsync(url_2); var result2 =…
Hamid Z
  • 180
  • 1
  • 14
0
votes
0 answers

C# GetAsync await returns Status code 204 Whereas PostMan returns 200

I have a Get API call to WebAPI using GetAsync method that fetches some values in JSON based on a location parameter. I am running the WebAPI call in a loop and for some reason, for certain Location parameters, the code returns "No content" status…
0
votes
2 answers

GetAsync using Basic Authentication even though I specify Bearer

I have the below GetAsync which I'm trying to authenticate with a bearer token but I get a 403 response. When I look at the request headers I can see Authorization: Basic YWJjOmRlZg== var client = new HttpClient(handler) { BaseAddress = new…
runnerpaul
  • 5,942
  • 8
  • 49
  • 118
0
votes
2 answers

How to make an HttpClient GetAsync wait for a webpage that loads data asynchronously?

I'm making a snippet that sends data to a website that analyses it then sends back results. Is there any way to make my GetAsych wait until the website finishes its calculation before getting a "full response"? Ps: The await will not know if the…
Soufiane Tahiri
  • 171
  • 1
  • 15