10787 : I want to host my UserControl with a Gantt in internet explorer and call it with javascript

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />Question

I am trying to host my UserControl that contains a plexityhide Gantt in internet explorer. I cant get it to work and I get more or less zero feedback on what goes wrong so I am lost… Further more I want to call some stuff inside the UserControl with javascript once I get the thing to load….



Depending on the strict security context there are many mistakes to be made and Microsoft has chosen not to reveal security exceptions to the end user to make it harder for hackers.


In .NET 2.0 there are good tools to see security exceptions and you may just as well learn about them directly so that you can get stuff to work.


#1 You want to be able to call my UserControl from Javascript. To handle this your UserControl must be made COM-visible. Check the box in Project/properties/Assembly Information called “Make assembly Com-visible”.


#2 To smoke out all big and small security breaches that effectively stops your UserControl from being loaded go like this:

– Create a new windows form project

– Add your UserControl to it

– Choose Project/properties/Security on the new windowsform project. Check “Enable clickonce security settings”. Set “Zone your app is installed from” to “Internet” (or what you need).

– Now run the new winform app and behold all the minor and major stuff that gets caught by the security context. Like you cannot use SystemColors since that will need system access on the client. You cannot do this: Application.CurrentCulture = new System.Globalization.CultureInfo

And since you cannot set the culture you will get unexpected result from functions like decimal.Parse:

//HK decimal.Parse may not work since you may have the wring culture

//decimal num = decimal.Parse(Phase[“BudgetMoney”].ToString());

 Drag and drop requires extra permissions too

//gantt1.Grid.AllowDrop = true;   //HK Need UI-permissions


So either increase the security context by asking for more trust, or remove functionality…


Leave a Reply