たくさんの画像を使ったアプリを作っています。アプリケーションはサーバーから画像を取得し、一度に1つずつダウンロードします。多くの画像の後、ビットマップを作成すると例外が返されますが、これを解決する方法がわかりません。画像をダウンロードするための私の機能は次のとおりです。
public static Bitmap getImageFromWholeURL(String sURL)
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(sURL);
myRequest.Method = "GET";
// If it does not exist anything on the url, then return null
try
{
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(myResponse.GetResponseStream());
myResponse.Close();
return bmp;
}
catch (Exception e)
{
return null;
}
}
誰かがここで私を助けることができますか?前もって感謝します!