When you apply string URL to ImageUrl Property of image
control in asp.net webforms. It display image nicely if that image is located
in any of the directory and folder which is placed in application folder. But
sometimes we need to apply display image which is located under the folder
which is outside of application. Then applying direct url to that image control
would not work in most of the time.
Reason:
web
sites run under the NETWORK SERVICE user account, which will limit access to
files outside of the folder.
Solution:
If your application is hosted on
localhost then follow the process described below.
1. Open
IIS on your system.
2. Go
to the application folder. E.g. MyApplication.
3. Right
Click on the folder and select Create Virtual Directory.
4. Put
folder name in Alias textbox e.g. images_1.
5. Give
the physical path to the directory where image is placed and hit ok.
6. Now
your url for your image control will be Alias images_1/myimage.png.