Re: Security Exception thrown from non-executed code? WHY WHY WHY???

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Sijin Joseph (sijinNOSPAMdotnet_at_hotmail.com)
Date: 10/14/04


Date: Thu, 14 Oct 2004 09:24:56 +0530

What i think may be happening is that the security check is being
performed before the method gets JIT compiled so in that case it will be
scanned for security exceptions before the JIT compilation begins for
the method.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Kelvin wrote:
> Hi all,
>
> This is very strange.
>
> The ".Net Configuration" - "RunTime Security Policy" - "Permission
> Sets" used by my smart client includes all the permissions (not full
> trust).
>
> In the code, I notice that the call "if(HttpContext.Current == null)"
> always throws a Security exception.
>
> Ok, fine, then I don't call it. BUT, the code would still throw an
> exception even thought that line is not executed. For example:
>
> int i=0;
> if(i > 10) { // This block will never execute right?
> if(HttpContext.Current == null) {
> MessageBox.Show("It is null");
> }
> }
>
> It still throws an exception at "HttpContext.Current == null"!
>
> BUT if I put "if(HttpContext.Current == null)" into another method, it
> works fine. For example:
>
> int i=0;
> if(i > 10) { // This would work!
> if(CheckHttpContext()) {
> MessageBox.Show("It is null");
> }
> }
>
>
> public bool CheckHttpContext()
> {
> return HttpContext.Current == null;
> }
>
> Isn't it strange? By the way, does anyone know the different between
> "Full Trust" and a Permission Sets that includes all the permission?
>
> Thanks in advance!
>
> Kelvin



Relevant Pages

  • hijacked security/and surf habits
    ... msn.com i have had trouble controling my security ... did not take a security update and removed the patch from ... other updates something strange happened msn.com loaded ...
    (microsoft.public.access.security)
  • Re: Unrecognized IP Addresses before the site could go live!!!
    ... You see "strange IP addresses" in the w3svc logfiles. ... webserver, so why is it strange to see outside IPs ... Microsoft MVP (Windows Server System: Security) ...
    (microsoft.public.inetserver.iis.security)
  • Re: Linux Kernel Exploits / ABFrag
    ... Today I had a rather strange experiance. ... IDS began reporting strange TCP behaviour on my network segment. ... I remembered, vaguely - I sift through a lot of security mail each day, some ...
    (Incidents)
  • Re: hijacked security/and surf habits
    ... it but the security pick it up and has arecord of itwhich ... >trust that the patch has some kind of security problem ... >other updates something strange happened msn.com loaded ... >and at that page it meaning the update was not present ...
    (microsoft.public.access.security)
  • hijacked security/and surf habits
    ... it but the security pick it up and has arecord of itwhich ... >trust that the patch has some kind of security problem ... >other updates something strange happened msn.com loaded ... >and at that page it meaning the update was not present ...
    (microsoft.public.access.security)