Questions tagged [webexception]
81 questions
3
votes
0 answers
Setting Content-Type header on WebClient.OpenWrite generates WebException
I am using WebClient.OpenWrite to POST to a WCF HTTP Web service in .NET 4. If I set the content type on the WebClient headers, then I wind up with a WebException (400 - Bad Request) when the stream is closed.
var client = new WebClient();
//…

Visual Stuart
- 661
- 4
- 10
3
votes
1 answer
How do I get a custom message from a 403 error thrown from a java servlet caught as a WebException in .net?
I have a java servlet that throws a custom error 403 (Forbidden) when the user authenticates with an incorrect user/password.
Java Servlet code:
response.sendError(response.SC_FORBIDDEN, "Login Error: wrong password!");
On the .net side I catch…

darrickc
- 1,872
- 6
- 27
- 38
3
votes
2 answers
How to solve the Proxy Server 407 error in .NET.CORE
SO i have some code that accesses the html of a website given it woks but only in visualstudios.Framework for c# when this code is input into the app.config.
ps next…

Hamza Arshad
- 121
- 1
- 3
- 11
2
votes
0 answers
System.Net.WebException: Error getting response stream (ReadDone2)
I'm getting to following error when I try to port my code over to mono. It works fine in windows and it even compiles in Linux.
When I'm working with the HttpWebRequest(a button calls a method that performs a write into the stream, etc.) it throws…

Josh O'Bryan
- 327
- 2
- 9
2
votes
1 answer
Method seems unavailable for 403 response body in C#
Here is my web request code block,
scroll down to the bottom of it to the catch exception
try
{
var webRequest = System.Net.WebRequest.Create (WEBSERVICE_URL);
if (webRequest != null) {
webRequest.Method = "POST";
…

DroneLord
- 53
- 12
2
votes
1 answer
WebException NotFound received when using Silverlight with ASP.NET MVC
I'm not entirely sure how to explain this, but basically I am trying to use a Silverlight application hosted within an ASP.NET MVC application. I have a basic controller on the MVC side that contains a method which accepts some string parameter and…

Samuel Slade
- 8,405
- 6
- 33
- 55
2
votes
2 answers
How to parse internalexception from WebException Response
I have C# code that does a POST to an OData web service, which results in a record being inserted into a database. If there is an exception, such as a primary key violation, I want to capture and log the error message. However, the message is…

Mark Freeman
- 1,155
- 3
- 24
- 42
2
votes
0 answers
HttpWebRequest with proxy exception
I have a next problem: when I try to create a HttpWebRequest with proxy, I get a WebException with the message
The underlying connection was closed: The connection was closed
unexpectedly.
What I am doing wrong?
Here is my code:
var…

Nick Nikitin
- 29
- 2
2
votes
1 answer
How do I reissue a webrequest? Must I recreate Webclient?
The following code gets stuck in a while loop when an exception is encountered. This is because GetResponse is caching the data.
According to fiddler, no data after the first request is issued.
Is it a best practice to recreate the webclient to…

makerofthings7
- 60,103
- 53
- 215
- 448
2
votes
0 answers
Get RssFedd via WebRequest throws WebException
I use a simple call to get a RssFeed. But everytime I call the request, it throws a WebException which says "Remoteserver didn't answer".
But if I try it with IE/Chrome/Firefox, I got an answer.
So I tried to start a minimal consoleproject only with…

Kooki
- 1,157
- 9
- 30
1
vote
2 answers
Xml response file: Received in browser, not via C#
I'm trying to access the last.fm APIs via C#. As a first test I'm querying similar artists if that matters.
I get an XML response when I pass a correct artist name, i.e. "Nirvana". My problem is when I deliver an invalid name (i.e. "Nirvana23") I…

Sentropie
- 249
- 1
- 4
- 14
1
vote
1 answer
C# WebException Response Parsing Issues
I am making an API call to a third party API, the code snippet was made to make a request and extract the response body from the response into a string in .Net 3.1.
I can parse successful responses normally and successfully. We were able to parse…

junsoo kim
- 21
- 5
1
vote
1 answer
Flutter Bloc Testing not catching thenThrow WebException
I'm trying to test the BLoCs in my Flutter App but I hit a wall with this problem below.
===== asynchronous gap ===========================
dart:async …

afl10
- 11
- 1
1
vote
3 answers
Problem with Httpwebrequest (503)
I am using HttpWebrequest to GET the result from google.I use proxies to get the data.now there is a strange problem that for some queries it return the data and for some it throws the exception The remote server returned an error: (503) Server…

Afnan Bashir
- 7,319
- 20
- 76
- 138
1
vote
0 answers
System.Net.WebException: Error: TrustFailure (A call to SSPI failed, see inner exception.)
Getting following error in xamarin: System.Net.WebException: Error: TrustFailure (A call to SSPI failed, see inner exception.)
Below is my code:
UserRepository usr = new UserRepository();
var restClient = usr.RestClient; …

Shubham Bammi
- 11
- 1