简体   繁体   中英

Saving generated images on IIS virtual directory?

I need to create web API that generate some images and return their paths.

I create the path to save using:

var resultPath = "Images/" + obiektId.ToString() + ".png";
var fullPath = HttpContext.Current.Server.MapPath("/" + resultPath);

and return resultPath .

The problem is, that the virtual directory where I keep my site is C:\\\\sites\\siteA and HttpContext.Current.Server.MapPath("/" + resultPath) returns C:\\\\inetpub\\wwwroot\\Images\\123456.png . Then it is impossible for me to load the image from 10.0.0.106/siteA/Images/123456.png .

How can I save my image in my base virtual directory instead of saving it in wwwroot directory?

string resultPath = obiektId.ToString() + ".png";
string fullPath  = System.Web.HttpContext.Current.Server.MapPath("~/Images"+ resultPath );

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