Cache on PPC Device

V

victor

Hello,

Made an app for a PDA; it gets an image via HTTPWebRequest and
HTTPWebResponse.
All runs well on the PPC Emulator, but on the PDA it only gets the
image once. A repeated request does not produce another image.
A same request via the IE URL-bar works fine, so it can't be a caching
matter. What am I doing wrong?
Victor.
 
P

Peter Foot [MVP]

Can you post a code snippet? Are you closing the returned webresponses

Peter
 
V

victor

Thanks for replying! Here is the code snippet; 'hope you can help me
out.
**************************************************************
private void btnRqImage_Click(object sender, System.EventArgs e)
{
try
{
pbxImageHolder.Image = GetImage(IMG_URL +
txtRequestedImage);
wReq.Abort();
myStream.Close();
wRes.Close();
}
catch(Exception ex)
{
MessageBox.Show("@RequestButton:" + ex.Message);
wReq.Abort();
myStream.Close();
wRes.Close();
}
pbxImageHolder.Refresh();
}
//-----------------------------------------------------------------------------------------
private Image GetImage(string sURL)
{
try
{
//Create a web request to the url containing the image
wReq = (HttpWebRequest)WebRequest.Create(sURL);
wReq.Timeout = 5000; // wait for 5 secs

try
{
//gets the response from the web request
wRes = (HttpWebResponse)wReq.GetResponse();
}
catch (Exception ex)
{

System.Windows.Forms.MessageBox.Show("@GetResponse:" + ex.Message);
wReq.Abort();
return imgImage; // return the old image .....
}

//return image stream from the URL specified earlier
myStream = wRes.GetResponseStream();
}
catch(System.Net.WebException ex)
{

System.Windows.Forms.MessageBox.Show("@WebRequest.Create:" +
ex.Message);
}

try
{
if (myStream != null)
{
imgImage = new
System.Drawing.Bitmap(myStream);
myStream.Close();
wRes.Close();
return imgImage;
}
else
return null;
}
catch(System.Net.WebException ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
myStream.Close();
wRes.Close();
return null;
}
}
//-----------------------------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top