WebBrowser控件缓存问题 [英] WebBrowser control caching issue

查看:463
本文介绍了WebBrowser控件缓存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Windows窗体里面WebBrowser控件来显示PDF。

I am using the WebBrowser control inside a Windows Form to display a PDF.

每当PDF再生,但是,WebBrowser控件只显示其本地缓存版本,而不是从服务器更新的版本。

Whenever the PDF is regenerated, however, the WebBrowser control only displays its local cached version and not the updated version from the server.

我使用如下所示的刷新()方法来尝试并强制控制重新加载PDF,但它不工作:

I am using the Refresh() method shown below to try and force the control to reload the PDF, but it doesn't work:

_webBrowser.Navigate(pdfUrl);

_webBrowser.Refresh(WebBrowserRefreshOption.Completely)

我必须做别的强制刷新重新加载来自服务器的PDF?

Do I have to do anything else to force the refresh to reload the PDF from the server?

推荐答案

盛强是正确的 - 你需要的编程方式清除IE的缓存。这里是展示了如何在C#这样做样品code:
<一href=\"http://www.gutgames.com/post/Clearing-the-Cache-of-a-WebBrowser-Control.aspx\">http://www.gutgames.com/post/Clearing-the-Cache-of-a-WebBrowser-Control.aspx

Sheng Jiang is correct - you need the programmatically clear IE's cache. Here is sample code showing how to do this in c#: http://www.gutgames.com/post/Clearing-the-Cache-of-a-WebBrowser-Control.aspx

这主要是基于这里的Microsoft知识库文章:
http://support.microsoft.com/kb/326201

It is based heavily on the Microsoft KB article here: http://support.microsoft.com/kb/326201

和以pre抢先的问题 ​​- 是的,这是在脖子上一个巨大的痛苦,没有,没有它周围的另一种方式。祝你好运!

And to pre-empt the question - yes this is a huge pain in the neck, and no, there isn't another way around it. Good luck!

这篇关于WebBrowser控件缓存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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