You can use a WebClient object to download the image data from the URL into memory stream, and convert it to image; through this approach you’re able to set credential for the connection.
Code Snippet
void Form9_Load(object sender, EventArgs e)
{
string url = "your url here";
WebClient webClient = new WebClient();
CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri(url), "Basic",
new NetworkCredential("your username", "your password "));
webClient.Credentials = myCache;
MemoryStream imgStream = new MemoryStream( webClient.DownloadData(url));
pictureBox1.Image = new System.Drawing.Bitmap(imgStream);
}
Dear Kulvinder,
Try this
string url = "your image path";
pBox.ImageLocation = url;
HTH,
Suprotim Agarwal
|