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].

httpwebrequest
1,918 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
0 answers
2k views

HttpWebRequest timeout not obeyed

I have set up the following web request: HttpWebRequest request = (HttpWebRequest) WebRequest.Create(gotoWebinerUrl); request.Accept = "text/json"; request.Timeout = 5000; // Allows us to track with ...
Chris's user avatar
  • 2,649
3 votes
0 answers
966 views

C# HttpWebRequest URI losing its encoding and Web.config not respecting the setting to turn it off

I'm facing a problem where i am trying to call a REST API with some of the slashes encoded. like so: www.foo.com/method/TV%20Shows%2fEntertainment Now when calling on a browser that works fine, but ...
metaphysics's user avatar
3 votes
2 answers
711 views

Stream writeheaders take too much time WCF

A similar question is asked at NewRelic stream & writeHeaders I am profiling my WCF services on New Relic. There is a WCF service which calls another WCF service. Now I suppose while calling the ...
Deeps's user avatar
  • 557
3 votes
0 answers
2k views

Windows mobile 6.5 (c#.net cf 3.5) download file gets stuck on Stream Read

I have the following method which is used to download a file. It works fine, unless the internet connection drops during the download process. In that case, it gets stuck on the receiveStream's read (...
unohoo's user avatar
  • 378
3 votes
1 answer
853 views

MPNS sending pushing forbidden response 403

I want to use MPNS in my windows phone app and we are going to authenticate the webservice which is sending the push to clients. I have the done the all steps that are needed for MPNS authentication....
Arslan Pervaiz's user avatar
3 votes
2 answers
2k views

HttpWebRequest login with hidden input

I'm trying to login in to a website using a HttpWebRequest in a Windows 8 Store Application. The login form looks like this: <form method="post" action="" onsubmit="javascript:return FormSubmit();"...
Sand0rf's user avatar
  • 150
3 votes
1 answer
8k views

C# HttpWebRequest form upload

im trying to automate a file upload from my C# program. This is the method to upload a file. public static string UploadFileEx(string uploadfile, string url, string ...
triGun's user avatar
  • 71
3 votes
0 answers
917 views

BasicHttpBinding, ServiceReference from WSDL - performance issues

I am currently experiencing some difficulties diagnosing some BasicHttpBinding/ServiceReference performance issues. In some instances, when using a Stopwatch to time a synchronous method call to the ...
jamespconnor's user avatar
  • 1,402
3 votes
1 answer
3k views

I am getting WebException: "The operation has timed out" immediately on HttpWebRequest.GetResponse()

I am scraping the content of web pages heavily in a multi-thread environment. I need a reliable downloader component that is tolerable to temporary server failures, connection drops, etc. Below is ...
Trident D'Gao's user avatar
3 votes
0 answers
226 views

Performance hit of "Automatically detect settings" for the first request

I have the following piece of C# code: for (var i = 0; i < 10; i++) { var stopwatch = Stopwatch.StartNew(); var request = (HttpWebRequest)WebRequest.Create("http://www.google.com/"); ...
huseyint's user avatar
  • 15k
3 votes
1 answer
290 views

Developing a multi-tenant application so that users can work in different organizations using different tabs in same browser

I'm developing a multi-tenant application with ASP.NET MVC3. There users should be able to log into several organizations and they should be able to work in those organizations using different tabs of ...
Lasantha Bandara's user avatar
3 votes
0 answers
160 views

HttpWebRequest returned with a stale resource even though cache-control has max-stale 0

Given a HttpWebRequest performs a GET against a URL with Cache-Control max-stale=0 and the server returned a resource with max-age=900, why would the returned HttpWebResponse have IsFromCache=true ...
Iain's user avatar
  • 10.6k
3 votes
1 answer
4k views

HttpWebRequest, Redirects, chunked encoding error on live site, but works i IIS Express locally

I have some code that creates a HTTP POST WebRequest with C# and posts some data to a https site. That site then redirects to a new URL and returns some data. This works just fine on my local machine ...
Johan Nordberg's user avatar
3 votes
1 answer
371 views

Trying to login to a website clicking a button

I've just started playing around with C# few weeks ago. i got a task i am trying to perform and not sure if the way i do it now is the right approach. I am trying to login to a website(in my case ...
Yaniv Kossas's user avatar
3 votes
2 answers
3k views

FTP through FTP proxy

I am trying to download a file using FTP through a FTP proxy (on my side). This is script I am trying to implement in C#: On Commandline: ftp -i -s:get.ini CORPORATE_PROXY.com -----------get.ini---...
Jack's user avatar
  • 350
3 votes
1 answer
6k views

How can I save files from ftp?

I have a methode that copy folder structure from ftp to local folder and then copy all files that consists in them: public void CreateDirectories() { FtpWebRequest request = (FtpWebRequest)...
revolutionkpi's user avatar
3 votes
0 answers
2k views

How to tunnel an SSL connection correctly between two NetworkStreams?

HttpWebRequest doesn't support SOCKS proxies, so after a long research I've determined, that the best way to add SOCKS support for WebRequest and WebClient (without reinventing the wheel, like ...
RoliSoft's user avatar
  • 755
3 votes
2 answers
228 views

Resend ASP.Net Authentication:

I have a Asp.net Web Project using authentication mode="Forms". My login works perfectly. Now the Problem is that I have a link in a site that is only available to authorized users. It is possible ...
mr.moe's user avatar
  • 75
3 votes
1 answer
2k views

Problem in Multiple Set-Cookies in httpwebrequest Header

I try to login amazon.com using C# HTTPWebRequest class, i can login but not able to read multiple set-cookies in header When the server responds with multiple "Set-Cookie:"-headers, only the first ...
mohan's user avatar
  • 31
3 votes
1 answer
2k views

Online exception:Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

We are talking about a software that I implemented (client and server sides), sometimes I get the following error while downloading. Is it something from the server side or the client side? ** The ...
Arrabi's user avatar
  • 3,728
3 votes
0 answers
551 views

Setting UserAgent for HttpWebRequest in Silverlight 4

I'm using Silverlight 4 and need to set (override) the UserAgent for a HttpWebRequest. Unfortunately this is not supported. The platform notes in MSDN state: "Do not use this member when targeting ...
Matt Lacey's user avatar
  • 65.8k
3 votes
1 answer
5k views

How to make HTTP request authenticated with anonymous NTLM using HttpWebRequest

My team recently discovered a bug in some of our service code, such that an HTTP request authenticated with the anonymous NTLM SID (not the same as HTTP Anonymous authentication; this is a successful ...
anelson's user avatar
  • 2,569
3 votes
0 answers
2k views

ObjectDisposedException when calling Abort on an HttpWebRequest used asynchronously

As the title indicates, I seem to be getting an ObjectDisposedException when calling "Abort" on an HttpWebRequest used asynchronously (i.e. BeginGetResponse) and can't, for the life of me, figure out ...
dreyln's user avatar
  • 860
3 votes
1 answer
6k views

Why does this powershell script make two web requests (System.Net.HttpWebRequest)?

According to my server logs, the following script seems to make two web requests instead of one. Every single time the second request is exactly 2 minutes later. I only want one request. What am I ...
jrummell's user avatar
  • 42.9k
3 votes
2 answers
2k views

Login using WebClient or HttpWebRequest

Iam having serious problem with login. I cant use WebBrowser class to login to site because WebBrowser is only single thread class. I cannot login with WebClient because I dont have a cookies. Tried ...
Kostek Kostecki's user avatar
2 votes
2 answers
561 views

bytes[] not receiving at web api using HttpClient C#

I'm sending bytes[] to .net core web api method(from Windows application to web API) by using HttpClient with below code HttpClientHandler clientHandler = new HttpClientHandler(); ...
Ra_g's user avatar
  • 45
2 votes
0 answers
925 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; ...
mohammad noori's user avatar
2 votes
0 answers
214 views

Trouble uploading a document to Salesforce using c#

I'm referencing the url https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm#inserting_a_contentversion and I see the curl methods, but c# can't ...
Mark's user avatar
  • 81
2 votes
0 answers
156 views

C# HttpWebRequest appends some strange characters in header just before POST characters

all I am having some strange errors that I have never experienced before. Usually I send GET and POST via C# HttpWebRequest. The code is so simple as below. HttpWebRequest _req = (...
Joshua Son's user avatar
  • 1,877
2 votes
0 answers
112 views

Mixing Sync and Async methods in the same HttpWebRequest

In their docs and examples, Microsoft says not to Mix calls to Sync and Async methods for the same HttpWebRequest (https://learn.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest....
Itai Bar-Haim's user avatar
2 votes
1 answer
178 views

Clear context after HttpWebRequest

We use an HttpWebRequest to send query to a webservice with NetworkCredential like this : Byte[] bytes = Encoding.UTF8.GetBytes("..."); HttpWebRequest request = (HttpWebRequest)WebRequest....
SeyoS's user avatar
  • 661
2 votes
1 answer
222 views

Get http web request send error in c# code

I am using HttpWebRequest to get the response back and save stream as json document on to my drive. When I test via Postman all works fine but when I run the below C# code I get error. C#: ...
paone's user avatar
  • 868
2 votes
0 answers
128 views

How to Find Desired Enumeration via Jazz Queries?

I need to either be able to obtain the list of options (with text values) for an enumeration and/or to search for the enumeration/url by a particular value. I can't seem to do either. To obtain the ...
CodeMonkey's user avatar
  • 1,815
2 votes
0 answers
437 views

Custom proxy server headers with .NET Framework HttpWebRequest using C#

I am using the HttpWebRequest class to implement a web crawler. I would like to use a proxy server with it which usually can be implemented like this: HttpWebRequest webRequest = (HttpWebRequest)...
Sam's user avatar
  • 1,534
2 votes
1 answer
333 views

Occasional response headers in C# HTTP Request

Request: HttpWebResponse response = (HttpWebResponse)request.GetResponse(); String responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); Console.WriteLine(responseString); ...
Raja K's user avatar
  • 21
2 votes
0 answers
1k views

How to ignore a CloudFlare warning with HttpWebRequest?

Here i do a Post request and i know the address (i am not the owner) and it is not malicious, I just want to Post the request and get the desired response. Web request code: HttpWebRequest oHTTP = (...
0_o's user avatar
  • 580
2 votes
0 answers
6k views

HttpWebRequest.GetRequestStream() - Error The underlying connection was closed: An unexpected error occurred on a send

I am getting an error on HttpWebRequest.GetRequest() when trying to send xml request on one web service for response. This same request working from Postman. Please guide in right direction to solve ...
bd coder's user avatar
2 votes
0 answers
536 views

Proxy-Authorization Header not working in HttpWebRequest, in case of Rest Request to a URL

I am using HttpWebRequest for fetching data from Rest API. I have proxy applied on my system and I need to authorize with Proxy Server in order to fetch data from Rest API. For Authorization, I am ...
raunakchoraria's user avatar
2 votes
0 answers
44 views

c# how to use webresponseasync method to download web pages'es sources

I have a list of web page links, and I need to download their sources. How to use async and await for this? List<string> webpages; //includes web pages links List<string> sources = new ...
mostrafael's user avatar
2 votes
0 answers
360 views

c# GetResponse() timeout, but works on browser

I'm trying to read the response i get from nyc.gov. I used Fiddler to construct the WebRequest and it keeps timing out. Important: this works if the url is https://www.google.com so it's got to be ...
Geo Hristodol's user avatar
2 votes
0 answers
45 views

HttpWebRequest memory leak issue with Newtonsoft

I have an application that calls an API via the below function. Public Function CreateWebRequest(ByVal strURL As String) As JArray Try Dim request As HttpWebRequest = ...
Rami Zebian's user avatar
2 votes
1 answer
6k views

C# calling a API endpoint with CSRF token its not working

I need to develop a .NET Job that triggers an execution in the HPOO software, by calling API endpoint that requires a CSRF token. Before I started coding, I tested the scenario in Postman: calling ...
João Paulo's user avatar
2 votes
0 answers
866 views

The underlying connection was closed: (HttpWebRequest) - C#

I am writing a code to authenticate the username and password through the POST request but I am getting an error which is saying that "The underlying connection was closed". I am trying to convert my ...
orbnexus's user avatar
  • 757
2 votes
0 answers
37 views

How to call this API from the back end of this web app sharing credential? They are on different Azure environment but on the same domain

I am not so into .NET and I am finding the following difficulies. I have a use case similar to this one: How to get HttpClient to pass credentials along with the request? Basically I have a .NET web ...
AndreaNobili's user avatar
2 votes
0 answers
3k views

c# webrequest post form-data

I have a Postman that do success post call to website using form-data: How can I post using form-data same as postman in c#? I was doing but is not working. string formParams = string.Format("Email=...
VAAA's user avatar
  • 14.8k
2 votes
0 answers
480 views

Binding web requests to specific network adapter

Background I have a mobile embedded device (Ubuntu/Mono) with 2 network adapters. One is WiFi and the other is GSM. The requirement is that when the WiFi adapter is connected to the internet (within ...
Louis van Alphen's user avatar
2 votes
0 answers
106 views

Force HttpClient or WebRequest to use TLS 1.0 for negative test

With the trend to disable TLS 1.0 at server side, I need a negative test in C#. This should be a single test method among many others that will test other features, and we have parallel tests. ...
fernacolo's user avatar
  • 7,252
2 votes
0 answers
1k views

How to place HttpWebRequest Host header first?

I'm using standard HttpWebRequest to get html page: using System; using System.IO; using System.Net; namespace TestConsole.Classes { class RequestHeadersOrder { public void Test() { ...
Spark13's user avatar
  • 146
2 votes
0 answers
2k views

How do I use Socks5 proxies with the WebClient class?

So I've been playign around with some code, looking at MSDN and trying to figure out how to use Socks5 proxies with the WebClient class. As from what I understand you can NOT use Socks5 proxies with ...
Mark Denom's user avatar
  • 1,047
2 votes
0 answers
84 views

User MATLAB's webread without plain text password

I have a webapi that uses AD's logins for authentication. If I want to access that webapi with MATLAB using webread, I can do that but apparently I have to place in plain text my username and password ...
rst's user avatar
  • 2,642

1
2
3 4 5
39