简体   繁体   中英

c# access an image in app_themes folder

I have an image in my App_Themes/Default folder that I want to load into a byte array. However I am having issues getting to the file. Is there any easy c# way to do this?

My solution looks like this:

-Project
-App_Themes
-Default
-image1.png

您可以使用Server.MapPath()获取相对URL的完整本地文件路径,例如:

string lFileName = Server.MapPath("~/App_Themes/Default/xyz.png");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM