This is going to be my first tutorial. It's not final, end-all, documentation on this subject. But it is what I have gotten from Channel9 discussions and online documentation. It will walk you through setting up a .NET Applet.
First of all, what is a .NET Applet? An Applet is basically a small application hosted in a larger application, in this case, the browser. Most common are Java Applets, but they are not the only ones. Items in the Windows Control Panel are called Control Panel Applets. .NET Applets are called that because they resemble Java Applets, but that is not their official name. Generally, the procedure I am about to describe is called ' Hosting Windows Forms controls in Internet Explorer '.
How do you create a .NET Applet? Very basically, you create a Windows Forms user control. That's right, you write Windows Forms code and your browser (Internet Explorer only) handles it. Then you put an <object>
tag into your html and specify some information about the Applet (the dll file, namespace, and class).
How does this work? Well, Internet Explorer is able to run .NET controls probably by using COM to host mscoree.dll (If you know more, let me know). If the user/client has the .NET Framework installed, and Internet Explorer 6.0 (I am not sure of 5) your user control will simply be gobbled up and used as a local control.
'Whoa! What is Microsoft doing to us? Think of the hole this could open up!!!', you say. Calm down. It runs in a ‘sandbox'. A special zone that limits what the control can do. It won't let you access local files with the exception of the OpenFileDialog
box, and then can only use the dialog box's OpenFile()
method. You cannot use the SaveFileDialog
. So you don't have to worry about some one messing with your hard drive. (To see which permissions an assembly has for all the different zones, you can go to Control Panel/Administrative Tools/.NET Framework 1.1 Configuration, and then under Runtime Security Policy/Machine/Code Groups/All Code.)
Comments