Quantcast
Channel: Troubleshooting
Viewing all articles
Browse latest Browse all 1814

IIS can't load image from UNC path nor Virtual directory

$
0
0

Hi,

I just mounted a web site locally with IIS manager. I can access the site from the path

http://192.168.154.2/Default.aspx

and I have a folder named Affiche wich contains some images and is situated in a remote server from the same network.

To access an image I am using an aspx page GetImage.aspx wich work like this :

var path = "//192.168.84.52/Distri/Affiche/10038P.jpg"


    if ((string.IsNullOrEmpty(imageName) == false))
    {

        try
        {
            // Retrieving the image
            System.Drawing.Image fullSizeImg;
            fullSizeImg = System.Drawing.Image.FromFile(path);
            // Writing the image directly to the output stream
            fullSizeImg.Save(Response.OutputStream, ImageFormat.Jpeg);
            // Cleaning up the image
            fullSizeImg.Dispose();
        }

        catch (System.IO.FileNotFoundException)
        {
            //MessageBox.Show("There was an error opening the bitmap." +
            //    "Please check the path.");
        }
    }

This solution works fine in localhost ( with Visual Studio), I an perfectly get the image with a link like this

http://localhost:3606/GetImage.aspx

, however

http://192.168.154.2/GetImage.aspx

does not work. It will only show a broken image icon. The remote can be accessed from my computer ( wich already inputed the login) where I have installed the web server.

I tried another solution by using this solution : a virtual directory

From the IIS manager I can perfectly view the files from the remote server, but when I try to acess the virtual folder like this :

http://192.168.154.2/afficheImage/20772G.jpg

I have an 500.19 error with insufficient permissions.

Is there a way to solve this please ?


Viewing all articles
Browse latest Browse all 1814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>