C#使用嵌入式Internet Explorer重新启动表单 [英] c# restarting form with embedded internet explorer

查看:108
本文介绍了C#使用嵌入式Internet Explorer重新启动表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在Win7 IE8上使用Visual Studio 8 C#

我有一个带有嵌入式Internet Explorer控件的表单,只是从工具箱"中拖出了

显示如下形式:

Hi
Using Visual Studio 8 C# on Win7 IE8

I have a form with an embedded Internet Explorer control, just dragged out from the ''Toolbox''

Showing the form like this:

void showIEForm()
{
  string url= "www.site-with-expired-certificate.com"

  using (MyIEform mif = new MYIEform(url))
  {
     mif.ShowDialog();
     mif.Dispose();
  }
}


IE随后会由于证书过期而发出安全警告.
然后,我接受警告并进入网站.没关系.

但是,如果我再次调用该函数,就不会再收到安全警告!
这告诉我表单以某种方式被重用,因为如果我像这样手动进行同样的操作:

1.启动IE转到网站->我收到安全警告
2.接受警告.
3.关闭IE
4.启动IE转到站点->我再次收到安全警告!

那么如何正确处理表单/互联网控件,以便每次启动表单时都得到一个新鲜"的IE ?!


IE then comes with a security warning due to expired certificate.
I then accept the warning and proceeds to the site. Thats all fine.

But if I call the function again I''m no longer getting the security warning!
This tells me that the form is somehow reused, because if I do the same manually like this:

1. start IE go to site -> I get a security warning
2. Accept warning.
3. close IE
4. start IE go to site -> I get a security warning again!

So how to properly dispose of the form/internet control so I get a ''fresh'' IE each time the form is started?!

推荐答案

为什么要每次都有同样烦人的错误吗?您可以根据需要从窗体中删除该控件,然后创建一个新控件并将其放置在该位置.
Why do you want the same annoying error every time ? You can just remove the control from your form, create a new one and put it in it''s place, if you must.


这篇关于C#使用嵌入式Internet Explorer重新启动表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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