[英]How to change the image button back to the previous image when user click the button again in asp.net using C#
[英]how to map image to image button in asp.net with session using c#?
我的項目解決方案中有一個圖像文件夾。 我為客戶捕獲圖像並將其保留在其中。 輸入詳細信息后,我將重定向到另一個aspx頁面,然后拍攝照片並返回到注冊頁面,並將圖像映射到圖像按鈕,我正在使用會話變量映射圖像文件夾中的圖像路徑。 我的問題是,即使我拍了一張新照片,我也會得到相同的圖像。 我每次在圖像文件夾中只保留一張圖片,為什么我會得到不在圖像文件夾中的上一張圖像。 我不應該得到我拍攝的新照片嗎? 請對此進行詳細說明並為我提供解決方案。.我將非常感謝您。
瀏覽器緩存可能在起作用。 解決該問題的一種方法是向圖像url(時間戳等)添加隨機的querystring參數,以使圖像url唯一。
<img src="someImage.png?someParam=1234" />
您不能以編程方式刪除瀏覽器緩存,但是以下代碼將幫助您禁用緩存並清除應用程序中的現有緩存...緩存是您的問題,如您所解釋的。
public static void DisablePageCaching()
{
//Used for disabling page caching
HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.