Questions tagged [webresponse]
135 questions
0
votes
1 answer
how to handle retry-after with WebResponse in a using block
I have my WebResponse wrapped in using blocks:
using (var response = request.GetResponse())
{
// do things...
}
The webservice I'm calling will raise 429's with a Retry-After in the header.
If I wrap this in a try-catch to listen for the…

Matthew
- 10,244
- 5
- 49
- 104
0
votes
1 answer
Multiple WebRequests to the same resource blocking each other?
So I have multiple threads trying to get a response from a resource, but for some reason - even though they are running in seperate threads, each response will only return when all others are either still waiting or closed. I tried using
WebResponse…

pixartist
- 1,137
- 2
- 18
- 40
0
votes
1 answer
500 error on api request. works fine when called through browser
Hello I have an api which authenticates the user login . Now when I hit this rest service in my browser it displays the result but when I try to do this using my code it gives in 500 error. Please help me with this .
My Api:…

Abhinav Moudgil
- 25
- 5
0
votes
1 answer
StreamReader OutOfMemoryException
I am using a web service that returns xml an I want to read it into a string. I am using ReadToEnd method of StreamReader class but at this moment OutOfMemory Exception occurs because of the large amount of xml data. Is there any way to get this .My…

user2762782
- 19
- 4
0
votes
1 answer
C# WebRequest Forbidden
using the URL http://myanimelist.net/malappinfo.php?u=fakemudkipper&status=all&type=anime
And using the code
WebRequest req = WebRequest.Create("http://myanimelist.net/malappinfo.php?u=" + username + "&status=all&type=anime");
WebResponse responce =…

Froodle
- 339
- 2
- 5
- 15
0
votes
2 answers
Why does Resharper give me this Constraint Violation, and how can I appease it?
I get several "Possible 'null' assignment to entity marked with 'NotNull' attribute" fingerwags from R# at code such as:
if ((webResponse.StatusCode == HttpStatusCode.OK) && (webResponse.ContentLength > 0))
{
var reader = new…

B. Clay Shannon-B. Crow Raven
- 8,547
- 144
- 472
- 862
0
votes
2 answers
WebRequest/WebResponse times out on fresh login
I have the following methods to retrieve data from a website I use:
private WebResponse GetWebResponse()
{
string formUrl = "https://www.draftkings.com/account/login";
string formParams = string.Format(
…

Jason D
- 2,634
- 6
- 33
- 67
0
votes
1 answer
HttpWebRequest deferring write requests
I'm wanting to track the state of my upload request, something like :
Upload packet
Update UI with progress
Upload packet
Update UI with progress
Upload packet
Update UI with progress
etc etc
So I tried the following code (gathered from…

pastillman
- 1,104
- 2
- 16
- 27
0
votes
2 answers
Threads are not responding
I'm trying to fix this issue from 2-3 hours but unable to fix it. I'm trying to download a file in three parts three threads. the problem is when one part is completed, other threads stop downloading.
Example: let's say i want to download 300kb…

Arpit
- 12,767
- 3
- 27
- 40
0
votes
3 answers
C# Grabbing text from a span
I tried this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Net.Sockets;
namespace ConsoleApplication1
{
class Program
{
static void…

xParaDoX
- 1
0
votes
1 answer
WebRequest.GetResponse does not return a 404 error
We faced a strange issue. Until yesterday and for many years we have in use a small piece of code in our application to access a specific URL in order to check if a specific file exist inside:
public static bool IsUpdateAvailable ()
{
…

Nikolas
- 45
- 6
0
votes
0 answers
WebResponse Get Response from Google Error 405 Method Not Allowed C#
I am trying to get a response from google in c# to get a token.
I am using the url - https://accounts.google.com/o/oauth2/token.
My code is the following;
public WebResponse GetResponse(string url, params GoogleParameter[] parameters)
{
…

user2885924
- 1
- 2
0
votes
1 answer
c# .NET Fast (realtime) webresponse reading
I got code, that sending GET request and recieves answer in stream. I read stream with streamreader to end. Here is code:
HttpWebRequest requestGet = (HttpWebRequest)WebRequest.Create(url);
requestGet.Method = "GET";
requestGet.Timeout =…

Lokley
- 35
- 1
- 7
0
votes
1 answer
Jersey Restful Testing with Junit
I am testing a DELETE verb in the following way which seems to work just fine.
@Test
public void testDelete() throws Exception {
WebResource webResourceTest = webResource.path("/deletesomestuff/delete").queryParam("FT","From Test");
final…

cbohannon
- 231
- 8
- 18
0
votes
2 answers
Decoding a response c#
I'm developing some API for testing, and I have a problem when I make a webrequest and especially when i retrieve the webresponse.
I use this code:
string request = HttpPost("http://iunlocker.net/check_imei.php", "ime_i=013270000134001");
public…

user2544906
- 1
- 2