如何强制图像加载的时候,ASP.NET [英] How to force Images to be loaded all the time, ASP.NET

查看:68
本文介绍了如何强制图像加载的时候,ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我服务包含图像一个的.aspx。我还没有想出如何强制IE7(6)所有的时间获取图像(例如重定向)。

到目前为止,我已经添加了以下标签我的.aspx页面上:

 < META HTTP-EQUIV =缓存控制内容=无缓存>
< META HTTP-EQUIV =语用内容=无缓存>
< META HTTP-EQUIV =过期CONTENT =0>

和仍然,如果我点击地址栏,然后按Enter或做一个重定向到同一页IE不会重新读取图像。

我是什么失踪?

其他注意事项:

  ISS 5
IE7 7.0.5730.13
工程于Firefox和其他地方,但IE浏览器

重定向code:

 的Response.Redirect(网址...,真正的);


解决方案

您可能只是把一个独特的标签上图像的URL的末尾,以确保高速缓存未命中。例如:

 < IMG SRC =/路径/要/ image.jpg的<%= DateTime.Now.Ticks.ToString()%GT; />

当然,如果你使用的WebForms你会想这样做有一点不同,但仍然沿着这些线路。

I am serving a .aspx that contains Images. I haven't figured out yet how to force ie7(6) to fetch the images all the time (e.g redirects).

So far, I've added the following tags on my .aspx page:

<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">

And still, if I click the URL Bar and hit enter or do a redirect to that same page IE won't re-fetch the images.

What am I missing?

Other Notes:

ISS 5
IE7 7.0.5730.13
Works on Firefox and everywhere else but IE

Redirect Code:

Response.Redirect("url...", true);

解决方案

You might just put a unique tag on the end of your image URLs to make sure the cache isn't hit. For example

<img src="/path/to/image.jpg?<%=DateTime.Now.Ticks.ToString()%>" />

Granted, if you're using WebForms you'll want to do it a little different, but still along those lines.

这篇关于如何强制图像加载的时候,ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆