作者:余小刚玩guitarvp_996 | 来源:互联网 | 2023-09-23 14:59
这包括FF5关于ASP.NET4和ASP.NET2.0的IE10和IE10浏览器文件。您可以更新您的整个机器的浏览器文件。1.将文件从复制。\machines文件夹复制到\Wind
这包括FF5 关于 ASP.NET 4 和 ASP.NET 2.0 的 IE10 和 IE10 浏览器文件。
您可以更新您的整个机器的浏览器文件。
1.将文件从复制。 \machines文件夹复制到\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Browsers,覆盖以前的版本
2.打开提升的命令提示符并运行\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regbrowsers.exe-i
3.重新启动IIS (例如,带有iisreset)
请注意中的文件.此zip 文件的\projects 文件夹中,从那些在不同。 \machines 文件夹。若要更新单个项目,将从文件的复制。 \projects 的 zip 文件到您的项目中的~\App_Browsers 文件夹。
尽管如此,更新单个项目的最简单方法是使用NuGet。
.Net4
PS >install-package App_BrowsersUpdate
为.NET2.0 (或者使用nuget.exe 命令行。
注:NuGet.exe 使用.NET4,所以如果您的计算机仅有.NET2,那么你需要手动复制文件。
PS >install-package App_BrowsersUpdate.net20
Browser version numbers continue to march on. IE9 is here, IE10 is coming, Firefox 5 and 6 are here with 7 and 8 in the wings, Opera's on 11, and Chrome is on, I dunno, somewhere between 14 and 50. Regardless, we'll all be on version 99 before The Singularity.
There is a bug in the browser definition files that shipped with .NET 2.0 and .NET 4, namely that they contain definitions for a certain range of browser versions. But the versions for some browsers (like IE 10) aren't within those ranges any more. Therefore, ASP.NET sees them as unknown browsers and defaults to a down-level definition, which has certain inconveniences, like that it does not support features like Javascript.
If you want to see this for yourself, create a new, blank Web site (e.g. in Visual Studio 2010), add a control that requires Javascript for postback (good example: ), and then run the site using IE9 (where it works) and IE10 (where it won't). View the page source and compare the HTML and Javascript sent to each browser.
A similar bug affects Firefox versions 5 and above, where support for using Javascript to reposition the scrollbar in the browser is not detected. This basically breaks the MaintainScrollbackPositionOnPostBack property for Web Forms pages.
These "misdetection" bugs affect Web Forms pages in both ASP.NET 2 and ASP.NET 4. If you are using ASP.NET Web Pages, or if you're using ASP.NET MVC or ASP.NET Web Pages and are not using the Browser object to detect Javascript support, you will not be affected.
FIXES
There are two ways to fix this: one is a machine-wide fix, the other is a way to fix individual sites.
MACHINE-WIDE FIXES
We're releasing a hotfix that will fix these, which you'll be able to get to via some KB articles. These KBs with fixes are live and are the best way to update your system. The fixes solve the browser-detection issue forever for all sites on a machine. These will be rolled up into future versions of the framework and will eventually also be on Windows Update.
- .NET 4 - http://support.microsoft.com/kb/2600088
- .NET 2.0
- http://support.microsoft.com/kb/2600100 for Win7 SP1/Windows Server 2008 R2 SP1, Windows Vista/Server 2008, Windows XP/Server 2003
- http://support.microsoft.com/kb/2608565 for Win7/Windows Server 2008 R2 RTM
What the fixes do is update the ie.browser and firefox.browser files in\Windows\Microsoft.NET\Framework\\Config\Browsers with new and future-proofed versions of these browser definitions. Nothing else is affected.
SITE-ONLY FIXES
If you don't have access to the whole machine and/or just want to update a single project, use NuGet to install the App_BrowsersUpdate package. Your site structure in Solution Explorer will then look like the image at right. Note that NuGet uses .NET 4, so for systems that have only .NET 2, you'll need to get the ZIP file and put the new browser files in App_Browsers manually.
- .NET 4 Browser Update NuGet Package -http://nuget.org/List/Packages/App_BrowsersUpdate
- install-package App_BrowsersUpdate
- .NET 2.0 Browser Update NuGet Package - http://nuget.org/List/Packages/App_BrowsersUpdate.net20
- install-package App_BrowsersUpdate.net20
- Note that NuGet is VS2010 specific so if you don't have nuget.exe and .NET 4, you can also copy the .NET 2 updated browser files into ~\App_Browsers manually from this zip file.
Updating the whole machine is the preferred way to fix this.
SUMMARY
- ASP.NET might not recognize the most current versions of some browsers, and will consequently treat them as down-level browsers. (Basically: no Javascript.)
- The fix is to get updated browser-definition files.
- You can install a machine-wide fix or just fix individual projects.
- Hotfixes are availble with download links.
- .NET 4 - http://support.microsoft.com/kb/2600088
- .NET 2.0 - http://support.microsoft.com/kb/2600100
- The files will also be part of the next batch of .NET 4 fixes, which are anticipated to ship around January 2012 via Windows Update.
- The next version of the .NET framework will include all the updated files.
If you're interested in more detail than you need, I’ve uploaded the updated versions of firefox.browser and ie.browser files that are expected to ship with the next version of ASP.NET. The files and source is up at my BitBucket repo if you are interested in the details.