![](/img/trans.png)
[英]Saving images relative to content directory where my site is running in IIS
[英]Saving generated images on IIS virtual directory?
我需要创建可生成一些图像并返回其路径的Web API。
我使用以下方法创建要保存的路径:
var resultPath = "Images/" + obiektId.ToString() + ".png";
var fullPath = HttpContext.Current.Server.MapPath("/" + resultPath);
并返回resultPath
。
问题是,我保存站点的虚拟目录是C:\\\\sites\\siteA
和HttpContext.Current.Server.MapPath("/" + resultPath)
返回C:\\\\inetpub\\wwwroot\\Images\\123456.png
。 然后我无法从10.0.0.106/siteA/Images/123456.png
加载图像。
如何将映像保存在基本虚拟目录中,而不是将其保存在wwwroot目录中?
string resultPath = obiektId.ToString() + ".png";
string fullPath = System.Web.HttpContext.Current.Server.MapPath("~/Images"+ resultPath );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.