-1

I have the remote computer, it name is A11 and a image file name is A22

i try my code use aspnet run IE11 , IE11 can show image ,but chrome can't show.

my code is same , as follow

protected void Page_Load(object sender, EventArgs e)
{
    Image2.ImageUrl = @"file://A11/A2222.jpg";
    Image1.ImageUrl = @"\\A11\\A2222.jpg";
}

i try other method

    FileInfo fi = new FileInfo(@"\\A11\\A2222.jpg");
    Response.AddHeader("Content-Disposition", "inline;Filename=" + @"\\A11\\A2222.jpg");
    Response.AddHeader("Content-Length", fi.ToString());

other method: clear Cache open image display option

but it is not working for chrome, it still no show my image

how can i do ?

ps.

chrome ver.78.0.3904.108

  • Open developer tools in chrome ctrl+shift+i, goto console tab and check for errors, then goto network tab, reload the page and look for the image download. – MikNiller Nov 22 '19 at 11:35
  • Thanks,this method is very useful, I successfully solved my problem. – user3679804 Nov 23 '19 at 03:27
  • as follow https://stackoverflow.com/questions/39007243/cannot-open-local-file-chrome-not-allowed-to-load-local-resource – user3679804 Nov 25 '19 at 02:22

1 Answers1

0

Most modern browsers doesn't allow local images to be shown unless you open a static html file from local disk. Since you are using asp.net webforms I will assume you are not doing this and you might need to rethink your approach.

If you simply need to be able to use images from a fileshare I would instead make a virtual directory on IIS and use this instead, so links becomes /virtualdirectory/somefile.jpg for example.

Thomas Schmidt
  • 359
  • 2
  • 11