Avatar of Salah a a a Al Jasem
Salah a a a Al Jasem
Flag for Kuwait asked on

vb asb.net displaying an image in image control setting ImageUrl

I have hundreds of thousands of images distributed in many different drives and folders

on (a.aspx)   my code is
<asp:Image ID="Image1" runat="server" Height="984px" Width="929px" />

on (a.aspx.vb)   my code is
Image1.ImageUrl = "D:/Images/Info/160597aa.gif"

It is executing the Image1.ImageUrl .. line    but -  the image is not displayed!!

if I do
<asp:Image ID="Image1" runat="server" Height="984px" Width="929px" ImageUrl = "D:/Images/Info/160597aa.gif"/>

then the image is displayed!!

I appreciate it if any one can help
ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
Salah a a a Al Jasem

8/22/2022 - Mon
Ryan Chong

on (a.aspx.vb)   my code is
Image1.ImageUrl = "D:/Images/Info/160597aa.gif"

It is executing the Image1.ImageUrl .. line    but -  the image is not displayed!!

you need to use a Server Side path instead of Local path. not every user's machine has D:/Images/Info/160597aa.gif.

the file in the local directory need to be mapped and accessible from web server end.

the outcome could be something using relative path like:

Image1.ImageUrl = "Images/Info/160597aa.gif"

Open in new window

Salah a a a Al Jasem

ASKER
The web page on (my server) gets the image from the D: drive which is also on my server      this is not related to the user's machine   I did that for the last 20 years using img tag and making src="d:\....."
ASKER CERTIFIED SOLUTION
Salah a a a Al Jasem

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ryan Chong

if I do
<asp:Image ID="Image1" runat="server" Height="984px" Width="929px" ImageUrl = "D:/Images/Info/160597aa.gif"/>

then the image is displayed!!
This actually doesn't work for me. I'm using VS 2010 premium edition.

ok, so you want to access an image file at: D:/Images/Info/160597aa.gif

what's the directory of your application located?

why don't just create a mapped directory in IIS for resolution? You need a path that can be accessible.

I have hundreds of thousands of images distributed in many different drives and folders
you need better organize the folder path of your images.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Salah a a a Al Jasem

ASKER
could not find an answer