Questions tagged [webresponse]
135 questions
3
votes
1 answer
How does WebResponse not have "Dispose" publically visible when it implements IDisposable?
After debugging through some code recently involving WebResponse, I found that the issue I had was that I was not properly disposing of the WebResponse before issuing another one. I was lead astray since WebResponse needs to be cast as an…

Seth Micalizzi
- 449
- 6
- 17
3
votes
2 answers
How to Get IP Address of Server responding to WebResponse C#
I am trying to find the ip address (not the hostname) that responded to my WebRequest in C#. I do not want to do a DNS resolution, because their are cases where the DNS records returned are not the servers responding to the request. For ex:
Client…

Traderde
- 31
- 2
2
votes
2 answers
Read the Realm property in HTTP authentication
How can I read the Realm property sent in the WWW-Authenticate header by a server requesting HTTP Basic authentication?

T4mer
- 430
- 2
- 7
- 22
2
votes
1 answer
System.Net.WebResponse throwing "System.Net.WebException: The operation has timed out" but connection to web server was made
I have a method which is intended to download a file from an HTTP URL to a byte array:
private static byte[] DownloadFileToByteArrayWorker(HttpWebRequest Request, int bufferLength)
{
byte[] responseByes = null;
//Round up to the nearest…

Mike Bruno
- 600
- 2
- 9
- 26
2
votes
2 answers
HttpClient Response returns scrambled data
I'm trying to get a proper JSON response from this URL using HttpClient. When I view the URL in Chrome the data is properly formatted JSON. When I use the HttpClient, I get a bunch of junk data that looks like bytes or something like that. I can't…

fahoover1976
- 21
- 3
2
votes
2 answers
How to post XML document to HTTP with VB.Net
I'm looking for help with posting my XML document to a url in VB.NET. Here's what I have so far ...
Public Shared xml As New System.Xml.XmlDocument()
Public Shared Sub Main()
Dim root As XmlElement
root =…

doremi
- 14,921
- 30
- 93
- 148
2
votes
2 answers
How to parse JSON data in System.Net.Webrequest reponse
I am trying to call an API which returns the data in JSON format which i need to parse. How to do that in System.Net.Webrequest..
Below is my code
ServicePointManager.ServerCertificateValidationCallback = new…

RackM
- 449
- 7
- 26
2
votes
0 answers
Want to Cache or session webresponse in Class library project in C#
Using below scenario in class library project
For storing and fetching the Webresponse from Cache
System.Web.HttpRuntime.Cache["cacheKey"] = resp;
resp1 = (WebResponse)System.Web.HttpRuntime.Cache["cacheKey"];
resp =…

Vikrant
- 147
- 1
- 10
2
votes
2 answers
Why does sending post data with WebRequest take so long?
I am currently creating a C# application to tie into a php / MySQL online system. The application needs to send post data to scripts and get the response.
When I send the following data
username=test&password=test
I get the following…
Paramiliar
2
votes
0 answers
GetResponse() in API call causes (400) Bad Request error
I am very new to programming.
I'm setting up a loop that continuously send a POST request to a site through the REST API. The POST request works properly and the way I intend.
I would like to add functionality that requires the response from this…

Jake K.
- 21
- 1
- 4
2
votes
1 answer
Close WebResponse, or Leave Open?
So I'm making a program which pretty much makes bulk HttpWebRequests. In this program, speed is main thing. If I can find ways to increase the HttpWebRequests by even a millisecond, then that's excellent.
Okay so my question is this: I have a method…

user2764359
- 127
- 3
- 18
2
votes
2 answers
C#: Post login data to form and process website's response
I am trying to write a C# program to prolong the deadline for my books in my university's library. What I want to do is the following:
1.) Login to library website via WebRequest & POST method, with username & password entered in C# program
2.) Get…

Jannik Pi
- 21
- 4
2
votes
1 answer
URL works in Browser but not get response from web Client or Web Request
I have an issue regarding response from server. (returns 403 forbidden).
When I am checking the same url in browser I can see the the page.
I have written the below code for getting response.
Same Code I am execute in my local PC, It works fine.
…

Nitin Vijay
- 1,414
- 12
- 28
2
votes
1 answer
WebRequest.GetResponse ignores my timeout value?
I'm trying to set a near-infinite timeout value on a WebRequest, considering that the HTTP-based API which I'm querying already graciously handles timeouts by sending back an XML document that declares a timeout. For some reason though, the…

Steven Liekens
- 13,266
- 8
- 59
- 85
1
vote
1 answer
internal server error while trying to load content into xdocument
XDocument xDoc = new XDocument();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
req.Timeout = 1000 * 60 * 5;
WebResponse res = req.GetResponse();
Stream responseStream = res.GetResponseStream();
xDoc =…

Navyseal
- 891
- 1
- 13
- 36