简体   繁体   English

ashx处理程序仅从ascx页面调用一次

[英]ashx handler called only once from ascx page

In .ascx page i have image button as follows: 在.ascx页面中,我有如下图像按钮:

"<asp:Image ID="imgPhotos" runat="server" Width="102" Height="82"/>"

In its code behind, I have: 在其后面的代码中,我有:

this.imgPhotos.ImageUrl = "~/lib/services/GetSpaceImage.ashx";

In GetSpaceImage.ashx, i am dynamically generating images. 在GetSpaceImage.ashx中,我正在动态生成图像。 But the problem is, for the first time it works good. 但是问题是,它第一次运行良好。 But, second time and so on it never generate the new images. 但是,第二次等等永远不会生成新图像。 Debugger hits hanlder only for the first time(when the application loads). 调试器仅在应用程序加载时第一次点击hanlder。 I have tried using: "context.Response.Cache.SetCacheability(HttpCacheability.NoCache);" 我尝试使用:“ context.Response.Cache.SetCacheability(HttpCacheability.NoCache);”

at the beginning of the ProcessRequest. 在ProcessRequest的开头。 But this also did not help. 但这也没有帮助。 Am i missing anything? 我有什么想念的吗? Please advice 请指教

浏览器缓存了此请求,为每个ashx URL添加唯一的参数,如下所示:

this.imgPhotos.ImageUrl = "~/lib/services/GetSpaceImage.ashx?param=" + DateTime.Now.Ticks.ToString();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM