1

在 .ascx 页面中,我有如下图像按钮:

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

在其背后的代码中,我有:

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

在 GetSpaceImage.ashx 中,我正在动态生成图像。但问题是,它第一次运作良好。但是,第二次等等它永远不会生成新图像。调试器仅在第一次(应用程序加载时)命中处理程序。我试过使用:“context.Response.Cache.SetCacheability(HttpCacheability.NoCache);”

在 ProcessRequest 的开头。但这也无济于事。我错过了什么吗?请指教

4

1 回答 1

1

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

this.imgPhotos.ImageUrl = "~/lib/services/GetSpaceImage.ashx?param=" + DateTime.Now.Ticks.ToString();
于 2012-04-17T12:25:04.637 回答