Reputation: 73
The WebBrowser
control automatically downloads the response from the server (when I only use the tradional WebBrowser.Navgiate()
), how do I ignore the file, or refuse the download (as it seems to pause my program)?
Edit: This is the code:
webBrowser1.Navigate("url/phpFile.php?parameters");
And this is what I get when I run it:
Upvotes: 2
Views: 3087
Reputation: 161
As a extention to NishantVerma.Me's awnser, this can be done programmatically. There is only one drawback, this has to be done with administrator privileges. My example is for a 32 bit application on a 64 bit device.
private bool SetRegistery()
{
try
{
using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Registry64))
{
using (RegistryKey key = hklm.OpenSubKey(@"MIME\Database\Content Type\application/json", true))
{
if (key != null)
{
key.SetValue("CLSID", "{25336920-03F9-11cf-8FD0-00AA00686F13}");
key.SetValue("Encoding", new byte[] { 0x80, 0x00, 0x00, 0x00 });
}
}
}
return true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return false;
}
Upvotes: 0
Reputation: 442
1.Open Notepad and paste the following:
Windows Registry Editor Version 5.00;
; Tell IE 7,8,9,10 to open JSON documents in the browser on Windows XP and later.
; 25336920-03F9-11cf-8FD0-00AA00686F13 is the CLSID for the "Browse in place" .
;
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
2.Save document as IE-Json.reg and then run it.
Tested on Windows 10 & Win 7
Upvotes: 2