V
Victor Hadianto
Hi all,
Newbie in this Code Access Security thing, I'm rather lost how to use
it. I've Googled through and still a bit confused. What I want to do
is simply this:
[SecurityPermission(SecurityAction.LinkDemand, Unrestricted = true)]
class ClassSecurity
{
public void Foo()
{
Console.WriteLine("SUCCESS");
}
}
Now I have another class to call the ClassSecurity's method:
class Class1
{
public void CallingMethod()
{
try
{
ClassSecurity cs = new ClassSecurity();
cs.Foo();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
I would expect that the cs.Foo() would fail as I don't declare any
security attribute on Class1. But it doesn't. Is this a misuse of the
SecurityPermission class? How should I implement the CAS to make
Class1 throws an exception when calling ClassSecurity?
Thanks,
Victor
Newbie in this Code Access Security thing, I'm rather lost how to use
it. I've Googled through and still a bit confused. What I want to do
is simply this:
[SecurityPermission(SecurityAction.LinkDemand, Unrestricted = true)]
class ClassSecurity
{
public void Foo()
{
Console.WriteLine("SUCCESS");
}
}
Now I have another class to call the ClassSecurity's method:
class Class1
{
public void CallingMethod()
{
try
{
ClassSecurity cs = new ClassSecurity();
cs.Foo();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
I would expect that the cs.Foo() would fail as I don't declare any
security attribute on Class1. But it doesn't. Is this a misuse of the
SecurityPermission class? How should I implement the CAS to make
Class1 throws an exception when calling ClassSecurity?
Thanks,
Victor