At the moment I am trying to make a web crawler and I am stuck with this error:
Exception thrown: 'System.Net.WebException' in System.dll
Additional information: The remote server returned an error: (405) Method Not Allowed.
Here is my code:
Stream receiveStream = null;
url = item1;
HttpWebRequest request1 = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response1 = (HttpWebResponse)request1.GetResponse();
receiveStream = response1.GetResponseStream();
StreamReader readStream = null;
if (response.CharacterSet == null)
{
readStream = new StreamReader(receiveStream);
}
else
{
readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
}
html = readStream.ReadToEnd();
response1.Close();
readStream.Close();
How can I skip to the next "item1" if I get this error?