2012-09-15 165 views
3

此代碼塊的網站例如:http://google.com或plus.google.com但https://google.com不起作用阻止網站在HTTPS

e.Cancel = e.Url.Host.Contains("google"); 
+0

沒有......閱讀請HTTPS – Federal09

+0

我們需要比這更多的代碼。這個叫什麼事件處理程序? –

+0

private void webBrowser1_Navigating(object sender,WebBrowserNavigatingEventArgs e) e.Cancel = e.Url.Host.Contains(「google」); } – Federal09

回答

2
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e) 
{ 
    e.Cancel = e.Url.ToString().Contains("google"); 
} 
+0

閱讀http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowsernavigatingeventargs.url.aspx – user1655481