Click here to Skip to main content
15,894,017 members
Home / Discussions / C#
   

C#

 
AnswerRe: Components for spell checker and PDF generation ? Pin
jtmtv181-Feb-03 17:45
jtmtv181-Feb-03 17:45 
AnswerRe: Components for spell checker and PDF generation ? Pin
Vasudevan Deepak Kumar1-Feb-03 18:11
Vasudevan Deepak Kumar1-Feb-03 18:11 
GeneralFile Splitter Pin
Jassim Rahma1-Feb-03 17:32
Jassim Rahma1-Feb-03 17:32 
GeneralRe: File Splitter Pin
Vasudevan Deepak Kumar1-Feb-03 21:46
Vasudevan Deepak Kumar1-Feb-03 21:46 
Generalcoding styles Pin
jtmtv181-Feb-03 14:21
jtmtv181-Feb-03 14:21 
GeneralRe: coding styles Pin
Chris Austin1-Feb-03 16:02
Chris Austin1-Feb-03 16:02 
GeneralRe: coding styles Pin
Vasudevan Deepak Kumar1-Feb-03 18:13
Vasudevan Deepak Kumar1-Feb-03 18:13 
GeneralGetting crazy with Deny() Pin
marcossl1-Feb-03 13:06
marcossl1-Feb-03 13:06 
I WANT make it clear that i dont want the highlighted code to run but it does, can make someone tell me why?
the permissions (intersecting all policy levels) for the assembly are unrestricted access to reflection. I checked it myself. I'm sure there is no mistake in the policy configurations

using System;
using System.Reflection;
using System.Security;
using System.Security.Permissions;

[assembly:ReflectionPermissionAttribute(SecurityAction.RequestRefuse,Unrestricted=true, Flags = ReflectionPermissionFlag.AllFlags)]

namespace reflectsecuritytest
{
public class mo
{
public static void met( int i )
{
}

public static void met( float f )
{
}

public static void met( string s )
{
}

public static int met( decimal d )
{
return 1;
}

public static void met( object o )
{

}


public int i = 9;
public static int x = 2;

private int pr
{
get
{
return 2;
}
}
}

[
ReflectionPermissionAttribute(
SecurityAction.Deny,
Flags = ReflectionPermissionFlag.AllFlags,
Unrestricted = true
)
]
class Class1
{
public static void PermisosReflect()
{

ReflectionPermission sec =
new ReflectionPermission(
ReflectionPermissionFlag.AllFlags

);

try {

sec.Deny();
//*************************
//*************************
// *********************************
// the next code is supposed not to execute, but it does
//*************************
//*************************
//*************************

Type t = typeof( mo );
BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Public |
BindingFlags.Instance | BindingFlags.Static;

foreach( MemberInfo mi in t.GetMembers( bf ) )
{
Console.WriteLine( mi );
};

} catch( SecurityException e ){

Console.WriteLine( e );

}
}


public static void Deny()
{
Console.WriteLine("before calling");


ReflectionPermission sec =
new ReflectionPermission(
ReflectionPermissionFlag.AllFlags
);
sec.Deny();

PermisosReflect();


Console.WriteLine("after calling");

}


[STAThread]
static void Main(string[] args)
{
Deny();
Console.ReadLine();
}

}
}


GeneralI am new here Pin
ThePhantomMenace1-Feb-03 9:14
ThePhantomMenace1-Feb-03 9:14 
GeneralRe: I am new here Pin
Christian Graus1-Feb-03 9:37
protectorChristian Graus1-Feb-03 9:37 
GeneralRe: I am new here Pin
Vasudevan Deepak Kumar1-Feb-03 18:15
Vasudevan Deepak Kumar1-Feb-03 18:15 
QuestionBest practice to build localizabled Applications ? Pin
Chris Richner1-Feb-03 6:40
Chris Richner1-Feb-03 6:40 
AnswerRe: Best practice to build localizabled Applications ? Pin
matthias s.1-Feb-03 9:11
matthias s.1-Feb-03 9:11 
GeneralRe: Best practice to build localizabled Applications ? Pin
Chris Richner1-Feb-03 9:38
Chris Richner1-Feb-03 9:38 
GeneralRe: Best practice to build localizabled Applications ? Pin
Chris Richner2-Feb-03 4:24
Chris Richner2-Feb-03 4:24 
GeneralRe: Best practice to build localizabled Applications ? Pin
ian mariano3-Feb-03 12:44
ian mariano3-Feb-03 12:44 
GeneralOleDbDataAdapter and more tables Pin
mkomasi1-Feb-03 6:36
mkomasi1-Feb-03 6:36 
GeneralRe: OleDbDataAdapter and more tables Pin
leppie1-Feb-03 8:01
leppie1-Feb-03 8:01 
Generalall computers in the network Pin
Calamitous1-Feb-03 2:13
Calamitous1-Feb-03 2:13 
GeneralRe: all computers in the network Pin
leppie1-Feb-03 6:17
leppie1-Feb-03 6:17 
GeneralPersonalizing Custom Controls Pin
Anonymous31-Jan-03 17:24
Anonymous31-Jan-03 17:24 
GeneralRe: Personalizing Custom Controls Pin
andyharman2-Feb-03 0:32
professionalandyharman2-Feb-03 0:32 
GeneralA question of form ;) Pin
antoine@orchus-tech31-Jan-03 16:07
antoine@orchus-tech31-Jan-03 16:07 
GeneralRe: A question of form ;) Pin
jtmtv1831-Jan-03 17:04
jtmtv1831-Jan-03 17:04 
GeneralRe: A question of form ;) Pin
antoine@orchus-tech1-Feb-03 3:36
antoine@orchus-tech1-Feb-03 3:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.