Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

asp.net:PermissionSet.Demand does not throw SecurityException in medium trust

$
0
0

Hi,

I use following code to check whether my assembly is in medium trust or full trust,

try

{

    new PermissionSet(PermissionState.Unrestricted).Demand();

}

catch(SecurityException)

{

}

I also implement a custom IHttphandler and invoke code above.  But even if I set my website as medium trust with .net framework 3.5, PermissionSet.Demand() does not throw SecurityException.

Strangely, it works fine with .net framework 4.0.

Is this a bug of .net framwork 3.5? or I should implement trust level checking by another way?

Thanks.


Viewing all articles
Browse latest Browse all 31927

Trending Articles