witam
mam taki problem związany z reqest i response: dla niektórych stron moja obsługa wyjątkó pokazuje 'timeout' dla innych (np. www.blumen.de): 'object reference not set to instance of an object' dlaczego tak jest? niektóre domeny są zabezpieczone przed czytaniem .. a może coś trzeba jeszcze ustawić?
proszę o fachową pomoc
void readingModule() // reading to stream
{
if (rbuttonOnline.Checked)
{
if (textBox1.Text.ToString().Length == 0) MessageBox.Show("Please write www adress!");
else
{
string adress = "http://" + textBox1.Text.ToString();
HttpWebRequest request;
HttpWebResponse response;
try
{
request = (HttpWebRequest)WebRequest.Create(adress);
request.Timeout = 9000;
request.Accept = "text/html";
response = (HttpWebResponse)request.GetResponse();
//MessageBox.Show(response.ResponseUri.AbsoluteUri);
Stream stream = response.GetResponseStream();
storeData(stream);
response.Close();
stream.Close();
}
catch (Exception ex)
{
MessageBox.Show("error : "+ex.Message);
}
}
}
else
{
string path = @textBox1.Text.ToString();
if (path.Length == 0) MessageBox.Show("Please write local path!");
else
{
if (File.Exists(path))
{
FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read);
storeData(stream);
stream.Close();
}
else MessageBox.Show("Bad path. Try again!");
}
}
}