那假設我們想要在Controller中直接取得Content或Script的絕對路徑(path)呢?
public ActionResult Image(string id) { var dir = Server.MapPath("/Images"); var path = Path.Combine(dir, id + ".jpg"); return base.File(path, "image/jpeg"); }
效能有差一點點就是了...
參考資料:
public ActionResult Image(string id) { var dir = Server.MapPath("/Images"); var path = Path.Combine(dir, id + ".jpg"); return base.File(path, "image/jpeg"); }
沒有留言:
張貼留言