C
Christian Urbanczyk
Hello!
I have a problem with the Webrequest. I've search everywhere to find an
answer but it seems that no one has the the problem before. So i hope
somebody can help me here!
Following Code:
_________________________________________
WebRequest wrq = WebRequest.Create(URL);
WebResponse wrs = wrq.GetResponse();
Stream strm = wrs.GetResponseStream();
StreamReader sr = new StreamReader(strm, Encoding.ASCII);
string line = sr.ReadLine();
while (line != null)
{
// here I do what i need with the line
line = sr.ReadLine();
}
__________________________________________
It works ONE TIME and then i get always a timeout. I tried everything, first
request is no problem.. The URL is not the problem, because it works with
all only one time...
I also tried another method for the request, but with the same problem:
__________________________________________
WebClient client = new WebClient();
Stream data = client.OpenRead(URL);
StreamReader reader = new StreamReader(data);
string line = "";
line = reader.ReadLine();
while( line != null)
{
// here I do what i need with the line
line = reader.ReadLine();
}
___________________________________________
Example:
I invoke the method with::
GetWebPage(URL);
GetWebPage(URL2);
Then I get just the information from URL. I get a timeout for URL2!
When i change them:
GetWebPage(URL2);
GetWebPage(URL);
Then I get just the information from URL2. I get a timeout for URL!
Thank you for any help!
Christian
I have a problem with the Webrequest. I've search everywhere to find an
answer but it seems that no one has the the problem before. So i hope
somebody can help me here!
Following Code:
_________________________________________
WebRequest wrq = WebRequest.Create(URL);
WebResponse wrs = wrq.GetResponse();
Stream strm = wrs.GetResponseStream();
StreamReader sr = new StreamReader(strm, Encoding.ASCII);
string line = sr.ReadLine();
while (line != null)
{
// here I do what i need with the line
line = sr.ReadLine();
}
__________________________________________
It works ONE TIME and then i get always a timeout. I tried everything, first
request is no problem.. The URL is not the problem, because it works with
all only one time...
I also tried another method for the request, but with the same problem:
__________________________________________
WebClient client = new WebClient();
Stream data = client.OpenRead(URL);
StreamReader reader = new StreamReader(data);
string line = "";
line = reader.ReadLine();
while( line != null)
{
// here I do what i need with the line
line = reader.ReadLine();
}
___________________________________________
Example:
I invoke the method with::
GetWebPage(URL);
GetWebPage(URL2);
Then I get just the information from URL. I get a timeout for URL2!
When i change them:
GetWebPage(URL2);
GetWebPage(URL);
Then I get just the information from URL2. I get a timeout for URL!
Thank you for any help!
Christian