user168507
user168507

Reputation: 881

URL parsing in ASP.NET

I'm trying to parse a URL, but I'm having problems:

http://www.meteor.gov.tr/deniz/deniz-suyu-sicakligi.aspx

When I call HttpWebRequest it throws a exception:

System.Net.Sockets.SocketException:

Eine vorhandene Verbindung wurde vom Remotehost geschlossen

In english:

System.Net.Sockets.SocketException: a existing connection was closed by the RemoteHost

I think it has do with IIS or ASP.NET. I don't have this problem with any other URL.

What can I do now?

Upvotes: 1

Views: 1170

Answers (2)

NT_
NT_

Reputation: 2670

The remote host is probably closing the connection as something is identified as not right. Check the kind of data (HTTP headers) you are sending with your GET/POST request and try to make it similar to a web browser's (e.g. my web browser can view the page).

If you do these things, there is nothing to separate the two calls from one another, making most remote hosts believe you are a legitimate visitor.

Upvotes: 1

Anton Gogolev
Anton Gogolev

Reputation: 115877

Define "parse URL". If you just want to parse http://www.meteor.gov.tr/deniz/deniz-suyu-sicakligi.aspx string, construct a System.Uri instance with this string as a constructor argument.

If you want to download content of this page, use HttpWebRequest.

Upvotes: 0

Related Questions