Access files on remote server

I am creating a website and I need to display an image of the employee next to their details. The details about the employee are stored in a SQL Server database and one of the fields contains the name of the image eg Picturesemployeename.jpg .

The actual location of the file is on a server and the URL to that is

ServerNameFolder1Folder2ImagesPictures

In my code I am concatenating the 2 parts to make the following string

ServerNameFolder1Folder2ImagesPicturesPicturesemployeename.jpg

I then attach that to the image.imageurl but when I run my code it just displays the AlternateText message.

I originally stored the server location in the Web.config file, but after reading on here and other sites, thought that creating a Virtual Directory on IIS was the correct option.

I have created a Virtual Directory called EmployeeImages and set its physical path to ServerNameFolder1Folder2ImagesPictures . But when I run my code it returns the file location for where the web application is stored.

What am I doing wrong?

Thanks in advance

EDIT

Thanks for everyone's assistance. After some little tweaks I have managed to get it working, but only in IE and Edge. It won't work if I run it in Chrome?

链接地址: http://www.djcxy.com/p/36094.html

上一篇: 你如何处理与NSFetchedResultsController的部分插入?

下一篇: 访问远程服务器上的文件