需要在程序中实现,不是降低安全级别 ,设置信任站点之类的 打开HTTPS类安全网页,就因为弹出安全警报,网页就会等待 单击确定 就像邮箱中的一样,我想是不是可以在弹出对话框时 在程序中是先单击确定的功能,请高手赐教!谢谢

解决方案 »

  1.   


    以前也遇到过.没解决..不过好像他只弹出一次...
    换成用XMLHTTP来他仍然弹出来...估计不是WebBrowser的设置问题...
      

  2.   

    用IInternetSecurityManager接口直接设置webbrowser自己的的安全级别
      

  3.   

    http://www.codeproject.com/KB/atl/vbmhwb.aspx
      

  4.   

     public class WebBrowserExtendedEvents : System.Runtime.InteropServices.StandardOleMarshalObject, DWebBrowserEvents2
        {
            ExtendedWebBrowser _Browser;
            public WebBrowserExtendedEvents(ExtendedWebBrowser browser) { _Browser = browser; }        //Implement whichever events you wish
            public void BeforeNavigate2(object pDisp, ref object URL, ref object flags, ref object targetFrameName, ref object postData, ref object headers, ref bool cancel)
            {
                _Browser.OnBeforeNavigate((string)URL, (string)targetFrameName, out cancel);
            }        public void NewWindow3(object pDisp, ref bool cancel, ref object flags, ref object URLContext, ref object URL)
            {
                _Browser.OnBeforeNewWindow((string)URL, out cancel);
            }    }    public class WebBrowserExtendedNavigatingEventArgs : CancelEventArgs
        {
            private string _Url;
            public string Url
            {
                get { return _Url; }
            }        private string _Frame;
            public string Frame
            {
                get { return _Frame; }
            }        public WebBrowserExtendedNavigatingEventArgs(string url, string frame)
                : base()
            {
                _Url = url;
                _Frame = frame;
            }
        }    [System.Runtime.InteropServices.ComImport(), System.Runtime.InteropServices.Guid("34A715A0-6587-11D0-924A-0020AFC7AC4D"),
        System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIDispatch),
        System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FHidden)]
        public interface DWebBrowserEvents2
        {        [System.Runtime.InteropServices.DispId(250)]
            void BeforeNavigate2(
                [System.Runtime.InteropServices.In,
                System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IDispatch)] object pDisp,
                [System.Runtime.InteropServices.In] ref object URL,
                [System.Runtime.InteropServices.In] ref object flags,
                [System.Runtime.InteropServices.In] ref object targetFrameName, [System.Runtime.InteropServices.In] ref object postData,
                [System.Runtime.InteropServices.In] ref object headers,
                [System.Runtime.InteropServices.In,
                System.Runtime.InteropServices.Out] ref bool cancel);
            [System.Runtime.InteropServices.DispId(273)]
            void NewWindow3(
                [System.Runtime.InteropServices.In,
                System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.IDispatch)] object pDisp,
                [System.Runtime.InteropServices.In, System.Runtime.InteropServices.Out] ref bool cancel,
                [System.Runtime.InteropServices.In] ref object flags,
                [System.Runtime.InteropServices.In] ref object URLContext,
                [System.Runtime.InteropServices.In] ref object URL);
        } public partial class ExtendedWebBrowser : System.Windows.Forms.WebBrowser
        {
            #region 变量        AxHost.ConnectionPointCookie cookie;
            WebBrowserExtendedEvents events;
            
            
            //窗口事件
            public event EventHandler BeforeNavigate;
            public event EventHandler BeforeNewWindow;        #endregion                #region 窗口事件
            [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
            protected override void CreateSink()
            {
                //MAKE SURE TO CALL THE BASE or the normal events won't fire
                base.CreateSink();
                events = new WebBrowserExtendedEvents(this);
                cookie = new System.Windows.Forms.AxHost.ConnectionPointCookie(this.ActiveXInstance, events, typeof(DWebBrowserEvents2));
            }        [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
            protected override void DetachSink()
            {
                if (null != cookie)
                {
                    cookie.Disconnect();
                    cookie = null;
                }
                base.DetachSink();
            }        public void OnBeforeNewWindow(string url, out bool cancel)
            {
                EventHandler h = BeforeNewWindow;
                WebBrowserExtendedNavigatingEventArgs args = new WebBrowserExtendedNavigatingEventArgs(url, null);
                if (null != h)
                {
                    h(this, args);
                }
                cancel = args.Cancel;
            }        public void OnBeforeNavigate(string url, string frame, out bool cancel)
            {
                EventHandler h = BeforeNavigate;
                WebBrowserExtendedNavigatingEventArgs args = new WebBrowserExtendedNavigatingEventArgs(url, frame);
                if (null != h)
                {
                    h(this, args);
                }
                //Pass the cancellation chosen back out to the events
                cancel = args.Cancel;
            } 
            #endregion    }
      

  5.   

    用一个API TIMER进行每隔半秒或0.1秒监控,发现就关闭(进程内)
    或者另做一个EXE进行关闭