WebBrowser Control - Prevent Right-Click

Randy Minder picture Randy Minder · Dec 20, 2010 · Viewed 16.5k times · Source

In my application, I have a form that contains a browser control in which I display an SSRS report. I would like to prevent the user from right-clicking in the browser control and being shown the popup menu. Ideally I'd like the right-click to do nothing. Is there a way I can accomplish this?

Answer

Chris Kooken picture Chris Kooken · Dec 20, 2010

You can set the IsWebBrowserContextMenuEnabled equal to false. You will probably also want to set AllowWebBrowserDrop equal to false too so they cant drag a url into the app and have it load.

        webBrowser1.IsWebBrowserContextMenuEnabled = false;
        webBrowser1.AllowWebBrowserDrop = false;