Physical Path for image saving. Asp.net

送分小仙女□ 提交于 2019-12-25 11:57:19

问题


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


回答1:


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.




回答2:


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.




回答3:


Try this article

http://www.aspsnippets.com/Articles/Display-Images-in-GridView-Control-using-the-path-stored-in-SQL-Server-database.aspx



来源:https://stackoverflow.com/questions/4843451/physical-path-for-image-saving-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!