Home : I want to host my UserControl with a Gantt in internet explorer and call it with javascript
Q10787 - FAQ: I want to host my UserControl with a Gantt in internet explorer and call it with javascript

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....

 

Answer

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...

 

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 2006-12-09.
Last Modified on 2006-12-09.
Last Modified by Administrator.
Article has been viewed 842 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article