poniedziałek, grudnia 04, 2006

ActiveX

Jajko czy kura?

Ten odwieczny problem znalazł swoje postać w pytaniu związanym z .NET:

Co lepiej wstawiać? WinForm do WebForm czy WebForm do WinForm?

Na stronach http://www.codeproject.com/cs/miscctrl/htmlwincontrol.asp?df=100&forumid=17987&exp=0&select=1461081 opublikowano sposób właczenie WinForm do WebForm. Pozwala to na włączenie bardzo zaawansowanych kontrolek w stylu ActiveX osadzonych w WinForm do stron internetowych (WebForm). Cenę za co musimy zapłacić jest oczywiście bezpieczeństwo aplikacji internetowej. "OK, let’s return to web application security 101. Web applications must NEVER trust the client (web browser). This is gospel whether the web page interfaces use JavaScript, Flash, ActiveX, Applets, AJAX or any other protocol or language. Every developer should be aware that basic HTTP proxies may alter anything about the HTTP request, even those generated by XHR. Great care should be taken to ensure that all security checks are performed on the server--no exceptions." - cytat ze świetnej pracy na temat rzekomego niebezpieczeństwa stosowania technologii AJAX, który znajduje się na stronach http://www.whitehatsec.com/home/resources/articles/files/myth_busting_ajax_insecurity.html. Nigdy nie ufaj klientowi - to stara zasada i odnosi nie nie tylko do klasycznego rozwiązania (przeglądarki internetowej), ale również i do innych form np. widgetów z Opery czy Yahoo.

Przechodzimy do tematu starego jak świat "uruchamianie ActiveX w środowisku nie IE". Na szczęście mamy parę sprawdzonych rozwiązań dostepnych dla technologii Mozilla. Na stronie http://www.iol.ie/~locka/mozilla/plugin.htm jest wtyczka (plug-in) do wersji FireFox 1.5. Do tego jest świetny artykuł na codeguru o tym jak "Kod zarządzany na stronach WWW (kontrolki .NETw IE)" - http://www.codeguru.pl/article-643.aspx a na codeproject jest inny "Simple way to expose a .NET WinForm control as an ActiveX control in any HTML page" - http://www.codeproject.com/cs/miscctrl/htmlwincontrol.asp?df=100&forumid=17987&exp=0&select=1311281#xx1311281xx (efekt wyszukania w gg 'embedding Winform in WebForm') do tego świetna recenzja ""I suppose that many people find this link like I did and think ActiveX is the only way to expose WinForms to the browser. This is not the case nor is it the best or reccomended method. Please review the following link: http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspx This is a much simple and straight forward way of embedding .Net WinForms inside of Internet Explorer. I want to add that this is not meant as a diss on the author of this article. He has a good solution to try to expose .Net control as an ActiveX object. I just believe that is not what people are really looking for when they find this. They just require a good way of embedding WinForm inside Internet Explorer"

Brak komentarzy: