Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

In my project i have to display data + Image in Datalist view control in asp.net.

While bind Datalist i found Image not fetching from Network Path.

My Images are stored in server and i am trying to load it with IP Address.

and Path is stored in sql server.

What I have tried:

i was tried bound datalist with sqldatasource. and also trying with Code.
Posted
Updated 14-Aug-18 4:04am
Comments
F-ES Sitecore 14-Aug-18 8:46am    
There's probably a problem with your code, but as we can't see it we don't know what it is. One issue you are going to have is that the default account your code runs under doesn't have access to the network so out of the box you can't read files from UNC paths, you'll need to change the anonymous user to one that has access.

Images are loaded from the client. When you put in the url to a page the web server processes the code and then returns html only. In that html you have images so the client then tries to request the images. So, the client has to have access to that same path.

What you need to do is put the images in a folder in your site and then return the url to the images, not the network path.
 
Share this answer
 
Comments
Vincent Maverick Durano 14-Aug-18 10:04am    
5ed
Typically, your images/files should be hosted within your website root folder which has proper permissions configured in IIS.

Your image path is hosted outside of your website which you can potentially get an error (e.g permissions error). To overcome that, you would need to setup a virtual directory (with the real directory where you want it) and in IIS, ensure that there is no direct access to that folder (paying particular attention to read and directory listing permissions).

PS: As a general rule, work on the principle that what belongs to the website should stay within the wwwroot folder structure, just as (for example) what belongs in "C:\Windows\System32" shouldn't go in "My Documents".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900