Questions tagged [httpwebrequest]
HttpWebRequest is a concrete class for .NET Framework applications that provides an HTTP-specific implementation of the abstract WebRequest class. Related tag: [webrequest].
5,558
questions
0
votes
0
answers
13
views
RestSharp POST problems
so basically i started learning http request with restsharp and to be honest there is a total confusion.
So i managed to log into my reddit account, catch upvote post request and i tried to post the ...
-1
votes
2
answers
47
views
Get Data of online API
I want to download data of this website into a json file but as I am quite new to coding with C# I cant manage to get the data. I want to get Data of https://discosweb.esoc.esa.int/api/objects the ...
0
votes
0
answers
12
views
Uploading files to SharePoint OnPremise 2016 using .NET Core 5.0 and HttpWebRequest C#
SharePoint CSOM is not supported in .NET Core 5.0, so I'm trying to use HttpWebRequest to upload files to SharePoint 2016 on-premise.
This code sample shown here works in .NET 4.7, however it throws ...
0
votes
0
answers
29
views
c# httpwebrequest 19th call fails
Odd behavior. At least for what I've seen. Need some guidance. Here's my calling sequence:
httpWebRequest = (HttpWebRequest)WebRequest.Create(strURL.ToString());
httpWebRequest....
0
votes
0
answers
17
views
httpwebrequest getrequeststream timeout issue
I am calling different API's through the HTTPWebRequest through 3 jobs. All API's work perfectly except one after 2-3 successful call I am getting timeout exception at getrequeststream. So below are ...
0
votes
0
answers
21
views
How can I Get a header in localhost after the permissions list check?
Here I have a game that needs to be connected to the Fitbit account. To do this, when I press the Authorize button, I said to open the authorize URl in the Fitbit page.
public void GoToAuthorizePage() ...
0
votes
1
answer
27
views
How to send HttpwebRequest request payload
I have a webRequest to create. So I am using (httpwebrequest)webrequest.Create("/get").
I need to send some payload/request body to this request.
But stream writer only seems to work with ...
0
votes
0
answers
52
views
How to upload json data using webclient to a custom class post method in VB.net?
I'm trying to upload Json data via WebClient to my web service post method, which is getting the body parameter as custom class variable.
I'm getting 404 error when I post the request. Looking ...
0
votes
1
answer
54
views
Issue using C# HttpWebRequest to send request to TikTok
I seem to be having issues just making a basic request to the TikTok homepage using the HttpWebRequest module in C#. Here is my code.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(...
0
votes
0
answers
45
views
HttpWebRequest.GetResponse() throwing multiple exceptions
I have this static class used for sending Http POST requests to my webserver via the HttpWebRequest libraries:
using Newtonsoft.Json;
using System;
using System.IO;
using System.Net;
namespace WebAPI
...
1
vote
2
answers
40
views
What's the correct way to send PARAMS when using HttpClient.SendAsync()?
I have an application that is using a remote API. That API requires that I send PARAMS before it will accept the request as valid. Currently I send x-www-form-urlencoded values through the Body of ...
0
votes
0
answers
33
views
AWS STS - SignatureDoesNotMatch error from HttpWebRequest but exactly the same signature works in Postman and Python
Due to our system complexity, we chose to follow the hard way of calculating the signature for AWS API instead of using AWS SDK. Below, 3 different ways for sending a request to Amazon STS to assume a ...
0
votes
1
answer
37
views
C# httpwebrequest is only sending GET requests even when method is set to POST
I'm using Xamarin C# and php to create a simple android app that sends coordinate data to an apache sql database. When I use httpwebrequest to send a POST request to the server php, it sends a GET ...
0
votes
1
answer
43
views
How do I make an HTTP request and then wait for a response in C#
I am trying to talk with a Service that responds to SOAP requests.
I have the call and response functionality working.
The issue I face is that I want to make a request that can take some time to ...
0
votes
0
answers
24
views
WebRequest using credentials not using proxy user and pass
It's like 5h I'm testing backconnect proxy I have which rotate on each request, but when I try to connect with proxy credentials (username , pass) it always connect and receive response from stream ...
0
votes
0
answers
27
views
Correct way to add "autorization : bearer" header in an HttpWebRequest
Context
I want to code this curl command in VB.NET
curl -X GET 'https://api.twitch.tv/helix/users?login=crunchprank' \
-H 'Authorization: Bearer YY' \
-H 'Client-Id: XX'
This curl works perfectly if ...
0
votes
0
answers
28
views
Reading simple response from Nodemcu via HTTP request
Please help me. I have simple NodeMcu webserver that has a /STATUS capability like this:
curl 192.168.0.200:8080/STATUS
response> Doors are open.
I am trying to read this via HTML request like this:...
0
votes
0
answers
22
views
Why does HttpWebResponse behave differently when integrated to Power BI Report Server custom security project?
I developped a Custom Security extension for Power BI Report Server as we needed a token validation process to athenticate users.
I coded a method in a C#.NET project which works on both dev and test ...
0
votes
0
answers
100
views
HttpWebRequest failing on send through website application, but works in console app
I have a form on my website that makes a basic Get request to an API (managed by the client). It was working for years, until suddenly, it started throwing the error:
The underlying connection was ...
1
vote
0
answers
29
views
Http Request being blocked by the Hosting provider?
I have a simple Php server which is expecting the simple http get request and then Respond with some encrypted data
The http web request is made by a small application which uses wininet.dll to make ...
0
votes
0
answers
27
views
DotNetShipping Library: The process was terminated due to an unhandled exception. Crashes server
I'm using the DotNetShipping Library.
Sometimes (once a week) I get below 2 errors on GetRates call.
The request was aborted: Could not create SSL/TLS secure channel.
and
Description: The process was ...
0
votes
0
answers
24
views
HttpWebRequest credentials are missing sporadically
I have the problem that on some devices my request does not contain credentials and on others it does.
Unfortunately I can't specify from what this problem comes.
Here is my code:
private static ...
0
votes
1
answer
52
views
Using HttpWebRequest/Response To Download A Binary (.exe) File From A Web Server?
I am writing a program that needs to download an .exe file from a website and then save it to the hard drive.
After many web searches and fumbling through examples here is the code I have come up with ...
0
votes
2
answers
136
views
Can you call an async web api controller method synchronously?
Let's say I have a webservice with the following API controller method:
public async Task<ActionResult<string>> Get()
{
await Task.Delay(1000);
return Ok("Success");
}
It ...
0
votes
1
answer
42
views
how to get the cookies while doing the post using C#
Below is the python code for getting cookies and it is worked as expected, and trying to convert this to C# but not getting the cookies.
Any other way i can convert below Python code to respective C# ...
0
votes
1
answer
41
views
C# HttpWebRequest Directory Listing using Regex
I've read through the thread "C# HttpWebRequest command to get directory listing" and can get the following code to work:
using System;
using System.Net;
using System.IO;
using System.Text....
0
votes
1
answer
86
views
Async download function, how to do it? VB.NET
I am working on coronavirus statistics dashboard as university project, and I have some problems with asynchronous source data download from sites with statistics.
Well, I failed to understand how to ...
0
votes
0
answers
38
views
HttpWebResponse - StreamReader - Extract 1 value from response
var url = "https://api-m.sandbox.website.com/v1/oauth2/token";
var httpRequest = (HttpWebRequest)WebRequest.Create(url);
httpRequest.Method = "POST";
httpRequest.Accept = "...
0
votes
1
answer
65
views
JSON HttpWebRequest always returns 400
I tried to make a request to test if people should be able to pay on invoice.
I've never made an API call with JSON data before so i read through some documentations and stack overflow questions and ...
0
votes
2
answers
88
views
Download file from URL if not modified recently using Powershell
I have a Powershell script that is downloading files continuously from a URL public directory. The script is supposed to download files from the directory that does not currently exist in our local ...
0
votes
1
answer
37
views
Read data written by HttpWebrequest connected to tcplistener via tcpclient c#
I am having a bit of an issue is reading data posted from Client to the Server.
To explain the server code
I have created a TCP listener and it keeps listening for any client a while loop.
ie., via ...
0
votes
1
answer
78
views
How to switch from HttpWebRequest to HttpClient?
I'm trying to send a request through HttpClient and read a response. This is the curl from which I tried to do this:
curl -H "Content-Type: application/json" --data \
'{comment: {text: "...
0
votes
0
answers
50
views
How to Transfer XML file (entered in TextArea) from one application to another in C#
I have one application named ABC and other Application named XYZ.
User clicks on a button in XYZ that send Authentication XML to ABC , where ABC authenticates the received XML and sends a response XML ...
-1
votes
1
answer
83
views
Why does WebRequest.Create(uriBuilder.Uri) add a slash at the end of the URI?
I wrote a little code in c# in order to invoke a REST web service.
Without request body since all the parameters are part of the URL.
I build my URI like this :
UriBuilder uriBuilder = new UriBuilder()...
0
votes
0
answers
83
views
How do I properly use StreamWriter when making multiple POST requests
I have a program that posts multiple transactions to an API, on average about 40/50 transactions per day and the program runs once daily (as a job). I am getting an error 'Cannot write to a closed ...
0
votes
0
answers
66
views
How to prevent System.Net.WebRequest from printing a bunch of data about the request to the console
I wrote a powershell script to test a bunch of api endpoints. I grab a list of api endpoints, iterate through them grabbing the status code and checking if things are up and running.
The core of the ...
0
votes
0
answers
44
views
Parsing json from html div in Powershell
I'm new in Powershell programming and what I need at the moment is parsing json from an html code. In my code I do a WebRequest request and in the response page I have this:
<html>
<body>
...
0
votes
1
answer
63
views
Why does Stream.CanRead return false when calling GetResponseStream() second time on HttpWebResponse object
In the below sample code, streamSupportsReading is false.
private void SomeFunction()
{
HttpWebResponse responseObj = GetFile();
bool streamSupportsReading = responseObj.GetResponseStream()....
0
votes
0
answers
98
views
How to get response from webrequest with login
I want to get a response from the web, but the response I get is not what I expected, How can I login by using HttpWebRequest?
My Code :
public static void CobaData()
{
try
{
...
0
votes
0
answers
59
views
How to send request to TLS 1.2 w Forward secrecy enabled server in C#?
Request to TLS 1.2 enabled server works fine with the below code. It doesn't work with forward secrecy enabled. Receiving "cannot create SSL/TLS channel" exception. Here is the code,
...
2
votes
0
answers
159
views
C# - Multiple web request at the same time
I want to fetch some data from a web api at same time. so I wrote this code :
public string GetData(string x)
{
try
{
string URL = "https://MyApi.com/api?data=" + x;
...
0
votes
1
answer
65
views
C# HttpWebRequest Exeption Cookies
Hi I'm trying to convert a python code to C#. My Problem is, that I have a problem to make a HttpWebRequest. I don't get the cookies for the POST Request.
The Website response is 404. That is correct. ...
0
votes
1
answer
48
views
What are the reasons an HttpWebRequest might take half a minute to get a response?
I'm developing an app for a school project which uses data from CoinGecko's free public API. The way I'm getting the data is with the HttpWebRequest class. At first, I was able to use the API fast, ...
1
vote
0
answers
813
views
Get List of files from folders and subfolders from sharepoint using REST API C#
I want to populate a list in my code, with the fileNames present in a folder and subfolders in Sharepoint Onpremises path.
Here is my code so far:
private void GetListOfFiles()
{
...
1
vote
0
answers
181
views
Invoke-WebRequest drop-in replacement for PowerShell 7 that uses System.Net.WebRequest
PowerShell 7's Invoke-WebRequest is much slower than PowerShell 5.1's. In some cases four-to-five times slower, as outlined in this issue. But even measuring the most basic web requests between the ...
0
votes
0
answers
62
views
Chart problem in get data from coinmarketcap
excuse me for my bad english.
I am a vb program(visual studio 2013) that get data from coinmarketcap. for example get month data chart for bitcoin from : https://api.coinmarketcap.com/data-api/v3/...
0
votes
0
answers
146
views
Getting error "HttpWebRequest Error: An underlying connection was closed: An unexpected error occurred on receive" while calling php web api
I am trying to call a web api hosted on another server from my localserver. The API which is getting called is meant to take more than 15 minutes to give the required response. But after 5 minutes of ...
0
votes
0
answers
21
views
Security questions about a system webapp - app
Good morning everyone.
As a school project I'm developing a "logistics 2.0" application that provides a continuous tracking of a truck with coordinates obtained from an app and then sent to ...
0
votes
1
answer
234
views
HttpWebrequest Authentication failed because the connection could not be reused
I'm getting Authentication failed because the connection could not be reused while using soap request.
var credentials = new NetworkCredential();
HttpWebRequest webRequest =
(HttpWebRequest)...
2
votes
1
answer
295
views
How can I make a http client that sends Base64 encrypted octet stream via Multipart form data?
Context
In my company we have a API that's very tricky to handle. I managed to make a successful PUT Request using Postman and now I want to build this same http request in C# using a simple Console ...