Re: Thread.Interrupt causing SecurityException

From: zia (ziaq_at_yahoo.com)
Date: 05/13/03


Date: Tue, 13 May 2003 09:08:54 -0700


Thank you for your response and for the detailed
explanation. I was thinking on the same lines that the
security had to be increased to make it work in the
intranet/internet zone. Well, as its not a good idea to
do that on the client machines I am not using
Thread.Interrupt anymore. Instead I'm using a flag to
stop the threads. The threads are in a loop as long as
the flag is active. Thanks again for your response.
zia

>-----Original Message-----
>Zia,
>
> You need the ControlThread security permission in
order to use
>Thread.Interrupt(). Neither the Internet zone nor the
Intranet zone has
>this permission.
>
> So, your first question is: How do you set the
permissions on the client
>machines? This is not recommended. You could change
all the clients so
>that the internet or intranet zone (depending on where
your control lives)
>have access to the Control thread permission. That's
bad because it could
>expose you to potential vulnerabilities from other
managed code authors.
>It's safer if you're in the intranet zone though.
>
> Your second question is how can you make your
assembly get permissions?
>Your assembly can't give it's self permissions
(otherwise the security
>system would be broken).
>
> So let's look at solutions:
>
> One option would be to give the assembly you want
downloaded a strong
>name & give that strong name increased rights. I
believe you'll need to end
>up downloading a Windows installer to each client.
Unfortunately I don't
>know the details of this method. You can search the
newsgroups for more
>info on this, I remember it was a particularly hot topic
back around V1.0
>SP1 when code download got disabled.
>
> Your final option would be to not use anything that
requires
>ControlThread permission. If your threads are sleeping
you could replace
>the sleep w/ a block on a ManualResetEvent & set that
event to wake the
>threads up. If your threads are already blocking on an
event you could use
>WaitHandle.WaitAll to block on that event & a manual
reset event to wake
>your threads. The final problem is if these threads are
Joining on another
>thread. I don't believe there's a good solution to
block on both threads &
>a wait handle (at least not w/o unmanaged code
permission where you can
>pinvoke out & do it). If this is how you're blocked you
could consider
>doing a non-infinite join & polling a flag. It's
certainly not efficient,
>but depending on # of threads it may work for your
purposes.
>
> I hope this is helpful.
>
>[keeping the lawyers happy: this message is provided as-
is, without
>warranty, no rights conferred, etc...]
>
>
>"Zia" <ziaq@yahoo.com> wrote in message
>news:058e01c314be$98d8e980$3301280a@phx.gbl...
>> I wrote a .net control dll that resides on a webserver
>> and runs inside IE6 of the client machines. It seems to
>> work fine except that whenever the main thread in the
>> control tries to do a Thread.Interrupt() to stop the
>> other threads that it had created, I get a
>> SecurityException. It says:
>>
>> Request for the permission of type
>> System.Security.Permissions.SecurityPermission ...
failed.
>>
>> My questions are:
>> How do i set the permissions either in my code or the
>> client machines to solve this?
>> If its required to set the permissions on the client
>> machines, can it be done programmatically?
>>
>> This dll would be available on the intranet and anyone
>> with IE and .net framework should be able to run this
>> without any custom installation.
>>
>> Thanks in advance!
>> zia
>>
>>
>
>
>.
>



Relevant Pages

  • RE: Could not find a part of the path - User control from within IE
    ... control which is hosted in a web page, ... files in the client computer's user profile local temp dir. ... permission if our control will access any particular sensitive or protected ... if you want to check whether the problem is related to CAS ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • User Rights
    ... I have a user who I have given FULL control rights to her network folder. ... She tells me she can not add permission for other folks to specific ... Client Domain: DOMAIN1 ...
    (microsoft.public.win2000.security)
  • RE: COM and hosted controls in IE
    ... client side, so you can only use the COM component registered on the client ... by default the IEHost winform control doesn't have the permission to ... before sending mail. ...
    (microsoft.public.dotnet.framework.interop)
  • Re: Forcing Ownership of files
    ... >> without that right IF they have Full Control. ... > have explicit permission to do whatever they like with the content of ... > when I first tuned up here from a Novell server to a Windows 2000 server ... Now they are worried about security so ...
    (microsoft.public.win2000.active_directory)
  • Re: PM Security Issue
    ... gives me permission to open projects in Microsoft Project Professional. ... Categories control what you can do it to. ... in which I am a team member, and in which my resources are team members. ... When the My Projects category is included in the Project Managers group, ...
    (microsoft.public.project.pro_and_server)