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)?
WebBrowser控件自动从服务器下载响应(当我只使用传统的WebBrowser.Navgiate()时),如何忽略该文件,或拒绝下载(因为它似乎暂停我的程序)?
Edit: This is the code:
编辑:这是代码:
webBrowser1.Navigate("url/phpFile.php?parameters");
And this is what I get when I run it:
这就是我运行它时得到的结果:
2 个解决方案
#1
1.Open Notepad and paste the following:
1.打开记事本并粘贴以下内容:
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.
2.将文档保存为IE-Json.reg,然后运行它。
Tested on Windows 10 & Win 7
在Windows 10和Win 7上测试过
#2
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.
作为NishantVerma.Me's awnser的延伸,这可以通过编程方式完成。只有一个缺点,必须使用管理员权限。我的例子是64位设备上的32位应用程序。
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;
}
#1
1.Open Notepad and paste the following:
1.打开记事本并粘贴以下内容:
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.
2.将文档保存为IE-Json.reg,然后运行它。
Tested on Windows 10 & Win 7
在Windows 10和Win 7上测试过
#2
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.
作为NishantVerma.Me's awnser的延伸,这可以通过编程方式完成。只有一个缺点,必须使用管理员权限。我的例子是64位设备上的32位应用程序。
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;
}