Link to home
Start Free TrialLog in
Avatar of David Megnin
David MegninFlag for United States of America

asked on

How to display image in <asp:Image> server control from local path or UNC network path

My web page was displaying images from this path just fine before we changed our domain as a result of our company rebranding:

<asp:Image runat="server" ID="IDPicture" ImageUrl="\\AnyServer\Pics\000000000.jpg" />

I know the path is correct because the image displays in the VS designer just fine.  The only thing that's change is our domain, so the web address went from syep.wf1broward.com/admin.aspx to syep.careersource.com/admin.aspx.

Staff will be scanning images and saving them to either their local C:\ drive or a network share (\\AnyServer) and need to have them immediately displayed in the web application.

ImageUrl="C:\Pics\000000000.jpg" /> doesn't work
ImageUrl="\\AnyServer\Pics\000000000.jpg" /> doesn't work (It did before our rebranding)
Image Url="file:///C:/Pics/000000000.jpg" /> doesn't work

How can I get the images to show if they are stored on the local PC, i.e. "C:\Pics\000000000.jpg"?

Thanks!
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

It may be a permissions issue. Make sure the permissions are set on the folder so that it can be accessed by the IIS.
Avatar of David Megnin

ASKER

Yeah, I'm just not sure what account to grant permissions to.

From my desktop workstation I opened the remote folder \\AnyServer\Pics and added Read, Read & Execute and List folder contents permissions to NETWORK SERVICE.  I'm not sure if that has to be done ON the server or if there's another account I need to grand permissions to.  ...ASPNET or something maybe?

Since the staff will be offsite, I'll need to have the page display the images from their local hard drive, "C:\IDPictures"
Well you cannot access images stored on their C drive unless they upload those images.

What account is the website apppool running under? You need to grant permission to that account.
"ApplicationPoolIdentity"... does that sound right?  That's what's listed in Advance Settings under Process Model | Identity.
Not seen that. It is usually one of the built in accounts like Network Service or can be a specific user account.
Sorry for the late reply; I wasn't in the office on Friday.

It looks like it may just not be possible, or at least practically feasible.  I'm just going to have the staff scan the ID pictures to their local laptops, in this case, and I'll copy the files from each of them into the /images folder of the web site they use for administration.  It would be nice for them to have the images available, from the local hard drive, on the admin site the moment they scan them, but they really only require the images to be available at a later date after initial intake, during an orientation check in later in the year.  By then I'll have copied all the images into the web site /images folder.

I'm going to leave this question open for just a bit to see if anyone offers any good solutions.

Adding an upload function would be a good idea, but I don't want ID images being transferred any more than necessary, so I'll just leave them on the laptop drives for now.
The problem with leaving images on laptops is the risk of losing those images (laptop stolen, damaged etc).
Yeah, that's the primary concern that my boss and I have discussed.  It looks like it's one of those risks that we have little choice but to accept.

It's still better than the staff's previous method.  They would scan everything onto paper and keep it in large three-ring binders.  ;-)
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Robert.  I think you're right about the old domain having been added to the Trusted Sites or Intranet zone.  I forgot about that.  

Yeah, my preference would be to use a network share so that everyone (well, all 2 or 3) can see all of the images, but "local only" would be okay as well.

I'll try again with your suggestions.  It may be later today before I get to it.  It's Monday and I have a dozen concurrent projects going on.  ;-)

Edit:  I had to "Google" that T-Shirt for a closer inspection.  ;-)
Did you ever come to a conclusion on this?
Yeah, I moved all the images to the web server.  Thanks for the follow-up.
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
Thank you for the information.