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
Sijin Joseph - 14 Oct 2004 04:54 GMT
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
> Hi all,
>
[quoted text clipped - 40 lines]
>
> Kelvin