Hi Marina & Clint,
Here is the (offending ...) code snippet:
-------------------------------------------------
private Image GetImage(string sURL)
{
HttpWebRequest wReq;
HttpWebResponse wRes = null;
Stream str = null;
//Create a web request to the url containing the image
wReq = (HttpWebRequest)WebRequest.Create(sURL);
try
{
//gets the response from the web request
wRes = (HttpWebResponse)(wReq).GetResponse();
//return the image stream from URL specified earlier
str = wRes.GetResponseStream();
}
catch (WebException Ex)
{
MessageBox.Show(Ex.Message);
}
if (str != null)
{
imgImage = new System.Drawing.Bitmap(str);
str.Close();
wRes.Close();
return imgImage;
}
else
return null;
}
------------------------------------------------------------------------------------
Setting a brkpt at the catch line was to no avail ... after executing
the GetResponse line the system pops up an unhandled error and you can
only do a 'Details' or 'Quit' action. Details give just a mere silly
line of 'Main+0xf'.
Appreciate your help!
Saya
================================================== ====
On Tue, 30 Aug 2005 11:08:10 -0400, "Marina" <so*****@nospam.com>
wrote:
It's not possible that it wouldn't go into the catch section if that is set
up to just catch Exception.
You need to show code.
<Saya> wrote in message news:dn********************************@4ax.com... Hi,
In my app I've done the following:
....
wReq=(HttpWebRequest)WebRequest.Create(someURL);
....
wRes=(HttpWebResponse)(wReq).GetResponse();
On this last line, the GetResponse generates a failure and my app
crashes with an exception error.
The question is: how can I catch this error? I've tried surrounding
the whole stuff with try-catch, but it doesn't enter my catch section!
From IExplorer I can see that they are able to do it: you just get a
blank page with a tiny red cross on it (instead of crashing ....).
Please advise; thank you.
Saya