0
我上傳圖像到服務器,它被正確保存在IIS網站文件夾中。問題是從控制器返回時,即使我在文件夾中看到的圖像已被替換,它仍然顯示前一圖像而不是新圖像。我想這可能是因爲緩存,並試圖:上傳的圖像未加載
namespace Web.Controllers
{
[Authorize]
[System.Web.Mvc.OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public class EditProfileController : Controller
...
}
照片上傳是這樣的:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult UploadImage(MyModel profile)
{
// check if image exists, delete it and save new one
...
RedirectToAction("EditView")
}
public ActionResult EditView()
{
ViewBag.Image = getProfileImage();
return View(myModel);
}