Code Inprivate Webbrowser RRS feed

  • Question

  • I wanted to create a program in InPrivate Webbrowser. Like InPrivate Browsing in Internet Explorer. No Clear Cache.

    My code:

        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        End Sub


    Monday, July 27, 2015 8:59 AM

All replies

  • Hi Blue else,

    We cannot run the WebBrowser control in InPrivate mode. It's not provided by WebBrowser control. If you want to open a URL in InPrivate mode, I suggest you open IE browser and set it's InPrivate mode to true. Code below is for your reference.

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim argument As String = String.Format("-private -nomerge {0}",TextBox1.Text)
        Process.Start("iexplore.exe", argument)
    End Sub

    Best Regards,

    Youjun Tang

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 28, 2015 9:08 AM
  • - This is code from

    Can you convert to Thank.

    static void Main()
        Application.Run(new Form1());
    [System.Runtime.InteropServices.DllImport("wininet.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)]
    public static extern bool InternetSetOption(int hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
    private static unsafe void SuppressWininetBehavior()
        /* SOURCE:
            *      A general purpose option that is used to suppress behaviors on a process-wide basis. 
            *      The lpBuffer parameter of the function must be a pointer to a DWORD containing the specific behavior to suppress. 
            *      This option cannot be queried with InternetQueryOption. 
            *      Suppresses the persistence of cookies, even if the server has specified them as persistent.
            *      Version:  Requires Internet Explorer 8.0 or later.
        int option = (int)3/* INTERNET_SUPPRESS_COOKIE_PERSIST*/;
        int* optionPtr = &option;
        bool success = InternetSetOption(0, 81/*INTERNET_OPTION_SUPPRESS_BEHAVIOR*/, new IntPtr(optionPtr), sizeof(int));
        if (!success)
            MessageBox.Show("Something went wrong !>?");

    Can you convert to Thank.

    • Edited by Blue else Wednesday, July 29, 2015 5:48 AM
    Wednesday, July 29, 2015 5:47 AM
  • Hi,

    Do you test the code? you could create a C# project, then test the code in this project. check if the WebBorwser is running in Inprivate Browsering.

    If it indeed works, you could find the way to convert this code to VB.

    Convert Tool:

    Also, as i know,  the  inprivate mode is not supported in WebBrowser.


    Monday, August 3, 2015 5:23 AM