R
Remigiusz Samosiuk
Hi everyone!!
I have such weird situation/bug I don't know how to solve
2 weeks ago I've done user control that is hosted in Internet Explorer.
This control in Load event starts backgroundworker
(http://weblogs.asp.net/rosherove/articles/BackgroundWorker.aspx) to
load some data from web service, and shows progress in progress bar.
Everything works great in default Internet Zone permission set, so now I
started to do another control to do similiar things.
But hey what's going on !!!
Background Worker seems to not working. So I had checked why, and found
that it has problem when it calls Control.Invoke method. It takes
SecurityException every time it will call it.
So I use reflector to find why, and found such lines of code in
Control.MarshaledInvoke method:
Control.ActiveXImpl impl1 = (Control.ActiveXImpl)
this.Properties.GetObject(Control.PropActiveXImpl);
if (impl1 != null)
{
IntSecurity.UnmanagedCode.Demand();
}
So my first suspicion was that for my first control I have set some
greater rights, but not, I have checked it on different computers and
found nothing - it works on client computers now without any additional
settings.
Later I've checekd - after debugging session with dissasembly window -
that for my first control Properties.GetObject(Control.PropActiveXImpl)
returns null, but for all other not.
Next thing I tried, was to create new UserControls but all have had the
same effect. Only the first one is working correctly.
Why, the first one control don't have this property set (but in debugger
I saw that it has ActiveXInstance property set)? I doesn't set anything
special on it. It was not so long ago, so I should remeber such special
settings.
What is my problem exactly?
1) Is Control.Invoke not premited for user controls hosted in IE and for
some reason one of my controls workarounds it?
OR
2) It should work, but I do something wrong?
Anyone ??
Thanks in advance
Remi
I have such weird situation/bug I don't know how to solve
2 weeks ago I've done user control that is hosted in Internet Explorer.
This control in Load event starts backgroundworker
(http://weblogs.asp.net/rosherove/articles/BackgroundWorker.aspx) to
load some data from web service, and shows progress in progress bar.
Everything works great in default Internet Zone permission set, so now I
started to do another control to do similiar things.
But hey what's going on !!!
Background Worker seems to not working. So I had checked why, and found
that it has problem when it calls Control.Invoke method. It takes
SecurityException every time it will call it.
So I use reflector to find why, and found such lines of code in
Control.MarshaledInvoke method:
Control.ActiveXImpl impl1 = (Control.ActiveXImpl)
this.Properties.GetObject(Control.PropActiveXImpl);
if (impl1 != null)
{
IntSecurity.UnmanagedCode.Demand();
}
So my first suspicion was that for my first control I have set some
greater rights, but not, I have checked it on different computers and
found nothing - it works on client computers now without any additional
settings.
Later I've checekd - after debugging session with dissasembly window -
that for my first control Properties.GetObject(Control.PropActiveXImpl)
returns null, but for all other not.
Next thing I tried, was to create new UserControls but all have had the
same effect. Only the first one is working correctly.
Why, the first one control don't have this property set (but in debugger
I saw that it has ActiveXInstance property set)? I doesn't set anything
special on it. It was not so long ago, so I should remeber such special
settings.
What is my problem exactly?
1) Is Control.Invoke not premited for user controls hosted in IE and for
some reason one of my controls workarounds it?
OR
2) It should work, but I do something wrong?
Anyone ??
Thanks in advance
Remi