K
Ken Varn
I have a WinForm UserControl that I am hosting in an ASP.NET web page. In
the UserControl, I am trying to load an image into a GDI Image object using
HttpRequest.
The problem that I am having is after instantiating the HttpRequest object,
I call the GetResponse method of the request. Right after this call, all
code that follows is skipped. No exception is thrown. I can't understand
what is happening here. Can someone help?
Example:
void LoadImage()
{
UriBuilder ImageUri = new UriBuilder(http://MySite/MyImage.jpg);
WebRequest Request;
WebResponse Response;
Bitmap Img;
try
{
Request = new WebRequest(ImageUri.Uri);
Response = Request.GetResponse();
// This is line is skipped and we immediately exit the function
Img = new Bitmap(Response.GetResponseStream());
}
catch(Exception Ex)
{
String Msg = Ex.Message; // I never get an exception.
Breakpoint is never hit.
}
}
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------
the UserControl, I am trying to load an image into a GDI Image object using
HttpRequest.
The problem that I am having is after instantiating the HttpRequest object,
I call the GetResponse method of the request. Right after this call, all
code that follows is skipped. No exception is thrown. I can't understand
what is happening here. Can someone help?
Example:
void LoadImage()
{
UriBuilder ImageUri = new UriBuilder(http://MySite/MyImage.jpg);
WebRequest Request;
WebResponse Response;
Bitmap Img;
try
{
Request = new WebRequest(ImageUri.Uri);
Response = Request.GetResponse();
// This is line is skipped and we immediately exit the function
Img = new Bitmap(Response.GetResponseStream());
}
catch(Exception Ex)
{
String Msg = Ex.Message; // I never get an exception.
Breakpoint is never hit.
}
}
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------