Physical Path for image saving. Asp.net

2019-08-24 07:10发布

I have a web project and I saved my images in Physical folders in hdd Like d:\SecretImages\Imagename. But I can't open the files when I have to?

I thought if it can saves for examle d:\SecretImages\Temp.jpg, I can open when I have to but, I can't.

Help me please, thanks

3条回答
兄弟一词,经得起流年.
3楼-- · 2019-08-24 07:29

its becus when iis get file, it get as ASP.NET user not local system user. just go to the folder and add IIS_IURS group to permission list. or just set folder accessible by everyone. this type of problem mostly not occur when local debugging. but will happen in production or network storage.

查看更多
你好瞎i
4楼-- · 2019-08-24 07:32

You cannot use file paths to show your images. The browser doesn't know where to find the images and the server wouldn't serve them up anyway due to security concerns.

You could/should use an HttpHandler to show the images.

I answered a similar question here on SO how to do this.

查看更多
登录 后发表回答