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 开发者_JAVA技巧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?
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.
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
.
精彩评论