asp.net - How do I display an image on a webpage from a network location? -
i have web application used internally points images on network drive.
it works when test in vs, images don't load once published.
i'm sure it's setting in iis can't figure out is.
each computer logged domain, , have access should allowed view image.
i tried changing authentication impersonate, no luck.
any ideas? thanks
i ended fixing issue changing way images loaded. rather using network path src, switched using generic handler render image.
so, image tag looks like
<img alt="item image" src="/imagehandler.ashx?f=100" />
and images loaded in handler following code.
public void processrequest(httpcontext context) { var f = convert.tostring(context.request.querystring.get("f")); var path = string.format("//network-share/images/{0}.jpg", f); var image = image.fromfile(path); context.response.clear(); context.response.clearheaders(); image.save(context.response.outputstream, imageformat.jpeg); context.response.contenttype = "image/jpeg"; httpcontext.current.applicationinstance.completerequest(); }
while still want figure out permissions issue, better overall solution. since pointing file location seems have cross browser compatibility issues, won't have here.
Comments
Post a Comment