[英]ashx handler called only once from ascx page
在.ascx頁面中,我有如下圖像按鈕:
"<asp:Image ID="imgPhotos" runat="server" Width="102" Height="82"/>"
在其后面的代碼中,我有:
this.imgPhotos.ImageUrl = "~/lib/services/GetSpaceImage.ashx";
在GetSpaceImage.ashx中,我正在動態生成圖像。 但是問題是,它第一次運行良好。 但是,第二次等等永遠不會生成新圖像。 調試器僅在應用程序加載時第一次點擊hanlder。 我嘗試使用:“ context.Response.Cache.SetCacheability(HttpCacheability.NoCache);”
在ProcessRequest的開頭。 但這也沒有幫助。 我有什么想念的嗎? 請指教
瀏覽器緩存了此請求,為每個ashx URL添加唯一的參數,如下所示:
this.imgPhotos.ImageUrl = "~/lib/services/GetSpaceImage.ashx?param=" + DateTime.Now.Ticks.ToString();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.