C# Windows Form, How do you set default download location using webbrowser?

Viewed 211

I am using a following code to use Internet explorer 11 on webbrowser.

private void Form1_Load(object sender, EventArgs e)
        {
            //need using Microsoft Win32
            int BrowserVer, RegVal;

            // get the installed IE version
            using (WebBrowser Wb = new WebBrowser())
                BrowserVer = Wb.Version.Major;

            // set the appropriate IE version
            if (BrowserVer >= 11)
                RegVal = 11000;
            else if (BrowserVer == 10)
                RegVal = 10001;
            else if (BrowserVer == 9)
                RegVal = 9999;
            else if (BrowserVer == 8)
                RegVal = 8888;
            else
                RegVal = 7000;

            // set the actual key
            using (RegistryKey Key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", RegistryKeyPermissionCheck.ReadWriteSubTree))
                if (Key.GetValue(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe") == null)
                    Key.SetValue(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".exe", RegVal, RegistryValueKind.DWord);
        }

Since it's importing setting from current internet explorer 11 on my pc, it's getting default download path from its setting too. But if I click other location when I download, it opens last location I used as default download location. Is there a way to set default download location on this? Like make it open C:\temp as default download location all the time regardless I used as previous download location?

0 Answers
Related