Over the past few months, I’ve run across a number of developers who have reported problems where their .NET application fails to render Flash or Silverlight content within a Web Browser Control.
The most common reason for this problem is that .NET, by default, compiles with a target of AnyCPU, which means that your application will run as a 64bit application if the user is running a 64bit version of Windows. This, in turn, means that the Web Browser Control is the 64bit version, and that, in turn, means that it will attempt to load the 64bit version of Flash or Silverlight. And there’s the problem—Adobe and Microsoft did not, as of the writing of this post don’t currently ship 64bit versions of these controls (both Flash and Silverlight have 64bit versions as of 2012). Unfortunately, most HTML content won’t detect that the browser is 64bit and will instead simply direct the user to install the 32bit ActiveX control (which won’t help).
Obviously, the same problem will occur with all other ActiveX controls which are only available in 32bit flavors, but Flash and Silverlight were are the most common culprits. Until ActiveX control vendors ship 64bit versions of their controls, the only real workarounds are to either avoid using HTML content that requires the controls, or force your application to run in 32bit mode. To accomplish the latter using Visual Studio 2008:
- Open the Solution Explorer
- Right-click your project
- Choose Properties
- Click the Build tab
- Change the Platform Target from AnyCPU to x86.
If you don’t have the source to a .NET application and are encountering this issue, you can tweak the executable file to force it to run in x86 mode using CorFlags.exe.