1
I would like to know if you have any library or any third party component that do the POST and GET on the websites. I need to navigate some sites but I can not do GET nor on the home page of a specific site, it always returns me error 599.
Attempts:
private void button8_Click(object sender, EventArgs e)
{
WebClient client = new WebClient();
string html = client.DownloadString("http://aplicacao2.jt.jus.br/dejt/");
}
private void button9_Click(object sender, EventArgs e)
{
var request = (HttpWebRequest)WebRequest.Create("http://aplicacao2.jt.jus.br/dejt");
var response = (HttpWebResponse)request.GetResponse();
string html = new StreamReader(response.GetResponseStream()).ReadToEnd();
}
The two attempts return me this error message:
"An unhandled Exception of type 'System.Net.Webexception' occurred in System.dll
Additional information: The remote server returned an error: (599) Unknown Reason."
I have tried every method of this link and all give the same error. https://stackoverflow.com/questions/4015324/http-request-with-post
I did the test by Postman (an extension of Chrome that performs these methods) and it worked normal.
You can put in your question your code attempts?
– Leonel Sanches da Silva
If the
HttpClient
does not work, the problem is not in the tool - it is in the way you use it. And unless you provide a MCVE, we can’t help you.– dcastro
Attempts added @Gypsy
– lucasc01
@lucasc01 It seems to me to be a specific server problem where it is picking up. There is nothing wrong with your code. But the server expects some form of request that does not occur using these classes. You need to figure out what is missing to meet the specific need. The page opens normally, these codes read other pages. The error is consistent in both ways. Maybe it waits for a user-agent or something that the browser usually provide by default. Maybe it’s purposeful to prevent people from automatically taking content.
– Maniero