Re: Thread.Interrupt causing SecurityException
From: zia (ziaq_at_yahoo.com)
Date: 05/13/03
- Next message: Tommy: "send email"
- Previous message: Sachi: "Back button Problem"
- In reply to: Dino Viehland \(MS\): "Re: Thread.Interrupt causing SecurityException"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
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
>>
>>
>
>
>.
>
- Next message: Tommy: "send email"
- Previous message: Sachi: "Back button Problem"
- In reply to: Dino Viehland \(MS\): "Re: Thread.Interrupt causing SecurityException"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|